Internally it uses the hash values. From the hash it calculates the bucket id and the max number of leading zeros for all the inputs for each buckets. All of these are deterministic operations, that do not depend on the order of insertion. 