Sid,
I'm afraid a hash table won't help much.
Given the elements as follows: { 10,20,30,10,20,20,30,30,30,30,10 }
All of them will be hashed into the 0'th cell for a % 10 hash function,
and then probably the overflow will be handled by chaining.
So that will be governed by m^2 in worst case.
So the algorithm would be O( m^2 log m ) just to populate the hash and find
the frequencies.
--
Anup Ghatage
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.