tags:

views:

76

answers:

2

If I use an array of linked list to implement a hash table, the "remove" function might require traversing through a "chain."

Is this also true for "deleting"?

+1  A: 

Sure, it applies to anything you try to do with the hash table. Remove, delete (which sound like the same thing to me), insert, search, you name it.

Carl Norum
What if i use an array of linked list to implement a hash table, my function, "add", could be implemented in a way that requires no probing???
Yeah I guess that's true, as long as you're willing to use linear search on the chains. You could just add your new item to the head of the chain.
Carl Norum
Thanks Carl, I just have one last question: When and If I use the linked list method, will i have direct access to the beginning of each individual chain?
Well that's kind of the entire point, yeah.
Carl Norum
+1  A: 

Yes. Nearly any operation may require following these chains. The key is to select a table size and hash function such that chains are typically short (ideally, nearly all of them should have no more than one item).

bdonlan