0

Why does a hash table with linear probing need a “no object” value or a parallel array of Boolean? Give an example of the problem that can happen if we have neither of these techniques? Which technique is more space efficient? Why?

0

1 Answer 1

3

Ask yourself this: What happens when we delete an item from a hashtable? If at some point when we inserted an element into the hashtable that caused a collision, we would have to linearly probe to find a better spot, but if we delete the original item and don't leave a marker we'll never be able to find the new item again.

As to which one is more efficient, generally leaving a "no object" value is the best, because the space has to be taken up any way so we might as well use it for something rather than allocating a whole new array to keep track of what memory is useless in the hashtable.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.