Hash Bubble sort?

S

Sebastian Hungerecker

Justin said:
How does one implement a bubble sort algorithm for a hash?

One does not as hashes are unordered and thus not sortable.

HTH,
Sebastian
 
D

Dave Bass

Sebastian said:
One does not as hashes are unordered and thus not sortable.

Well if the keys can be ordered (e.g. are Comparable), the hash can be
sorted by keys. If the values can be ordered, the hash can be sorted by
values. Which you do depends on your requirements.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,666
Latest member
selsetu

Latest Threads

Top