Data Structure
Data Structure
Q1: The keys 12, 18, 13, 2, 3, 23, 5 and 15 are inserted into an initially empty
hash table of length 10 using open addressing with hash function h(k) = k mod 10
and linear probing. What is the resultant hash table?
Q2: Draw the binary search tree whose elements are inserted in the following
order: 50, 72, 96, 107, 26, 12, 11, 9, 2, 10, 25, 51, 16, 17, 95, 51.
Q3: Construct a min-heap H from the following list of numbers: 44, 30, 50, 22, 60,
2, 55, 77, 55.
Q6: Implement a queue by a singly linked list L. The operations ENQUEUE and
DEQUEUE should still take O(1) time.
Q7: Explain how to implement two stacks in one array A[1..n] in such a way that
neither stack overflows unless the total number of elements in both stacks together
is n. The PUSH and POP operations should run in O(1) time.
Q9: For the set of {1, 4, 5, 10, 16, 17, 21} of keys, draw binary search trees of
heights 2 and 3.
Q10. Write a algorithm that searches a given key ‘x’ in a given singly linked list.
The function should return true if x is present in linked list and false otherwise.