Click to See Complete Forum and Search --> : Finding maximum in a Hashtable


humor_me
June 15th, 2009, 05:54 PM
Given an Hashtable, is there a way of finding the maximum element in the hashtable in less than O(n) in the worst case where n is the total number of elements in the Hashtable? In other words, is there a way of finding such an element by means other than doing a linear search?

HM

D_Drmmr
June 17th, 2009, 05:19 AM
A hashtable is unordered, so there is no way to do it faster than O(n).

becga
July 7th, 2009, 01:01 PM
Depends on the function used for hashing. Also depends on the no of digits of the integers we are using. Typically - a radix sort uses this. Worst case is still O(kN) but think of the best case.