I don't think that perfect hashing provides "nthentry" in constant
time.
You could store items in a vector indexed by the order in which they
were inserted. Retrieving an item would be constant time, but what
happens when you have thousands of items and you need to delete item
27? Now most of the items in the vector are in the wrong spot. If you
move them all down one, that is not constant time anymore.

I think I could do any 3 of the 4 operations, but all 4 is tough. Does
anyone have a solution. Particularly one which does not rely on n
being a fixed number of bits?

Don

On Jan 8, 11:40 am, "Karthikeyan V.B" <kartmu...@gmail.com> wrote:
> Hi,
>
> Use hashing, but with perfect hashing which does all these operations in
> O(1).
>
> Refer to Introduction to Algorithms by CLRS to learn about perfect hashing.

-- 


Reply via email to