Final 23-24-1
Final 23-24-1
b) Consider a hash table of size 11 implemented using an array A[0… 9]. A modulo hash function (mod 11) is used to
map the keys, and open addressing (Quadratic probing where, h(k) = primary hash + i + i 2 ) is used to handle collisions. If
53, 32, 43, 51, 99, 33, 44, 83, 22 are inserted into the hash table,
1) Show the contents of array A. (show your procedures)
2) What is the total number of collisions?
c) Consider a hash table of size 11 implemented using an array A[0… 10]. Double probing is used to map the keys, where,
h(k) =[ k mod 11 + i (1+k mod 97) ] mod 11) is used to handle collisions. If 53, 45, 35, 32, 43, 51, 99, 75, 33 are inserted
into the hash table,
1) show the contents of array A. (show your procedures)
Page 1 of 2
b) Deduce the time complexity for the following function in terms of variable n.
int myFunction (int A[], int n)
int x=1;
int y=1;
for (int i=0; i<n; i=i+1)
if(i % 2==0 )
x=x*A[i];
else
y=y*A[i];
return x+y;
part c part d
b) Write pseudo codes showing how to modify DFS to add temporal labels to graph
nodes; (d[u], f[u]).
c) Hand run the algorithm in part (b) with Stacks for the given graph starting from
node A. Tabulate your answer and show the resulting search tree with added
labels.
Page 2 of 2