0% found this document useful (0 votes)
3 views

Data Structure

Uploaded by

Nishi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Data Structure

Uploaded by

Nishi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CLASS TEST

SUBJECT: DATA STRUCTURE


TIME: 1 Hours, MARKS: 50 (10*5)

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.

Q4: Consider the following tree

List the node sequence that will be traversed when we use


(i) Inorder
(ii) Preorder
(iii) Postorder traversal techniques.
Q5: Let's consider the below graph for the breadth first search(BFS) traversal and
depth first search(DFS).

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.

Q8: Show how to implement a stack using two queues.

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.

You might also like