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.
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:
Need help on problems 3 and 4 only thanks in advance. Define the following terms: hash...
#3 [3 points] Sketch a hash table of size N=11, where the hash function is hash(key) = key mod N and quadratic probing is used to resolve collisions, after the following elements are inserted: 20, 42, 45, 49, 62, 72, 95. The probes are based on this equation: (H+c1∗i+c2∗i2)mod(N) and c1=1, c2=1. If direct hashing was used to store the same elements as the previous problems (20, 42, 45, 49, 62, 72, 95), what should be the minimum size of...
IN JAVA LANGUAGE:
For this lab you are required for implement the following
methods:
1. public QuadraticProbingHashTable( int size ):
As the signature of this method suggests, this is a constructor
for this class. This constructor will initialize status of an
object from this class based on the input parameter (i.e., size).
So, this function will create the array HashTable with the
specified size and initialize all of its elements to be null.
2. public int hash(int value, int tableSize...
5. Hashing (a) Consider a hash table with separate chaining of size M = 5 and the hash function h(x) = x mod 5. i. (1) Pick 8 random numbers in the range of 10 to 99 and write the numbers in the picked sequence. Marks will only be given for proper random numbers (e.g., 11, 12, 13, 14 ... or 10, 20, 30, 40, .. are not acceptable random sequences). ii. (2) Draw a sketch of the hash table...
This should be in Java Create a simple hash table You should use an array for the hash table, start with a size of 5 and when you get to 80% capacity double the size of your array each time. You should create a class to hold the data, which will be a key, value pair You should use an integer for you key, and a String for your value. For this lab assignment, we will keep it simple Use...