• Home
  • Textbooks
  • Data Structures and Algorithms in C++
  • HASHING

Data Structures and Algorithms in C++

Adam Drozdek

Chapter 10

HASHING - all with Video Answers

Educators


Chapter Questions

Problem 1

What is the minimum number of keys which are hashed to their home positions using the linear probing technique? Show an example using a 5-cell array.

Check back soon!
03:19

Problem 2

Consider the following hashing algorithm (Bell and Kaman 1970). Let $Q$ and $R$ be the quotient and remainder obtained by dividing $K$ by $T$ Size and let the probing sequence be created by the following recurrence formula:
$$
h_i(K)= \begin{cases}R & \text { if } i=0 \\ \left(h_{i-1}(K)+Q\right) \bmod \text { TSize } & \text { otherwise }\end{cases}
$$
What is the desirable value of TSize? What condition should be imposed on Q?

James Chok
James Chok
Numerade Educator

Problem 3

Is there any advantage to using binary search trees instead of linked lists in the separate chaining method?

Check back soon!

Problem 4

In Cichelli's method for constructing the minimal hash function, why are all words first ordered according to the occurrence of the first and the last letters? The subsequent searching algorithm does not make any reference to this order.

Check back soon!
09:33

Problem 5

Trace the execution of the searching algorithm used in Cichelli's technique with $\operatorname{Max}$ $=3$. (See the illustration of such a trace for $\operatorname{Max}=4$ in Figure 10.11.)

Lucas Gagne
Lucas Gagne
Numerade Educator

Problem 6

In which case does Cichelli's method not guarantee to generate a minimal perfect hash function?

Check back soon!
05:21

Problem 7

Apply the FHCD algorithm to the nine Muses with $r=n / 2=4$ and then with $r=2$. What is the impact of the value of $r$ on the execution of this algorithm?

Lucas Gagne
Lucas Gagne
Numerade Educator

Problem 8

Strictly speaking, the hash function used in extendible hashing also dynamically changes. In what sense is this true?

Check back soon!

Problem 9

Consider an implementation of extendible hashing that allows buckets to be pointed to by only one pointer. The directory contains null pointers so that all pointers in the directory are unique except the null pointers. What keys are stored in the buckets? What are the advantages and disadvantages of this implementation?

Check back soon!
View

Problem 10

How would the directory used in extendible hashing be updated after splitting if the last depth bits of $h(K)$ are considered an index to the directory, not the first depth bits?

James Kiss
James Kiss
Numerade Educator
00:38

Problem 11

List the similarities and differences between extendible hashing and $\mathrm{B}^{+}$-trees.

David Collins
David Collins
Numerade Educator
01:16

Problem 12

What is the impact of the uniform distribution of keys over the buckets in extendible hashing on the frequency of splitting?

Vysakh M
Vysakh M
Numerade Educator
01:43

Problem 13

Apply the linear hashing method to hash numbers $12,24,36,48,60,72$, and 84 to an initially empty table with three buckets and with three cells in the overflow area. What problem can you observe? Can this problem bring the algorithm to a halt?

James Kiss
James Kiss
Numerade Educator

Problem 14

Outline an algorithm to delete a key from a table when the linear hashing method is used for inserting keys.

Check back soon!
07:47

Problem 15

The function hash ( ) applied in the case study uses the exclusive or (xor) operation to fold all the characters in a string. Would it be a good idea to replace it by bitwiseand or bitwise-or?

Jacquelyn Trost
Jacquelyn Trost
Numerade Educator