Princeton Algorithms: Part 1 [week 6: Hash Tables]

来源:互联网 发布:windows 打tar包 编辑:程序博客网 时间:2024/05/17 04:44

Exercises


Explanation:
The correct answer is: P J G M

Here is the separate-chaining hash table after inserting the 12 keys:

0: W -> Q -> K -> N -> Z -> H
1: L -> X
2: P -> J -> G -> M



Explanation:
The correct answer is: P Q H R J K U W N D

Here is the array immediately after each insertion:

J: - - - - J - - - - -
N: - - - - J - - - N -
H: - - H - J - - - N -
P: P - H - J - - - N -
K: P - H - J K - - N -
D: P - H - J K - - N D
W: P - H - J K - W N D
U: P - H - J K U W N D
R: P - H R J K U W N D
Q: P Q H R J K U W N D




Job Interview Questions






0 0