Homework3
Homework3
Question 1 (30):
Given a hash table with m=11 entries and the following hash function h1 and step function h2:
h1(key) = key mod m
h2(key) = {key mod (m-1)} + 1
Insert the keys {22, 1, 13, 11, 24, 33, 18, 42, 31} in the given order (from left to right) to the
hash table using each of the following hash methods:
Question 2 (10):
Here is the array format of a heap: {100, 3, 36, 1, 2, 7, 19, 25, 17}
Apply Heapify rules to convert this array into a Max Heap. Show all the steps for full credit.
Question 3 (20):
Perform BFS and DFS traversal on this graph below starting from node A. At each step, show
the status of the queue and the result variable for the BFS traversal. Similarly, show the status
of the stack and the result variable at each step for the DFS traversal. Responses not showing all
the steps will not receive full credit.