Dec 30, 2008

How could a linked list and a hash table be combined to allow someone to run through the list from item to item while still maintaining the ability to

How could a linked list and a hash table be combined to allow someone to run through the list from item to item while still maintaining the ability to access an individual element in O(1) time?

Use a hash table the key is idx, the value is the current node’s value and next node’s hashed key, so we can random access the individual element also run through the list from item to item.

No comments:

Post a Comment