The wikipedia article on tries says:
Tries support ordered iteration, whereas iteration over a hash table will result in a pseudorandom order given by the hash function.
What does it mean by pseudorandom order in the context of a hash table?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It means that it is difficult to predict in which order the iteration will visit each object, though there is no actual randomness. While a hash table will generally iterate over each object in the same order if no changes has been made to it between these iterations, even something as simple as adding another object may change the order of iteration for the entire container.
This is becouse where hash tables stores an object is based on the hash function as well as the number of buckets in the hash table. Depending on the implementation, a hash table may increase its number of buckets as you add contents to it and then move around contained objects to match the new set of buckets and hence changing the order of iteration.