Question
Need help on problems 3 and 4 only thanks in advance.
Define the following terms: hash table hash func
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Question 3:

a) The linear probing is a method to resolve collisions in hash tables. The probe is calculated using the hash function.

Summary of the deletion algorithm is below. Note that it is very similar to that of the retrieve -- this is because the data must be found before it can be deleted.

  • Calculate the hash code for the given target key
  • Access the hash element
  • If the hash element is empty, the deletion has immediately failed.
  • Otherwise, check for a match between the target and data key
    • If there is a match, delete the hash element (and set the flag)
    • If there is no match, probe the table until either:
      • An match is found between the target key and the data's key; the data can be deleted, and the deleted flag set.
      • A completely empty hash element is found

b) The basic deletion operation is merely a retrieval followed by data removal (clearing the hash element, once the target has been found.)

Unfortunately, this has a negative side-effect on the way the retrieval works. Since the data retrieval operation relies on blank hash elements as the signal to stop probing, there is the possibility that a deletion operation will render some data items unfindable. Consider where a search for 'R' (which has the same hash code as 'A') is attempted, after 'D' has been deleted:

The data 'R' will never be found, as the probing had terminated too early; this is due to the hash element that stored 'D' (and kept the probing going) being deleted.

The solution to this problem is to define two different kinds of blank hash elements:

  • a purely empty element, which has never stored data; and
  • an "empty but deleted" element, which stored data that has since been deleted.
Add a comment
Know the answer?
Add Answer to:
Need help on problems 3 and 4 only thanks in advance. Define the following terms: hash...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT