(i) The worst-case computing time of Heapsort is O ( ). a) n b) nlog2n c) log2n d) n2 (ii) The solves the single-source shortest path problem for a non- negative weighted graph. a) Binary Search b) Breadth First Search c) Depth first search d) Dijikstra’s Algorithm (iii) In a diagraph, vertex w is said to be to vertex v if there is a directed arcs from v to w. a) Stack b) Queue c) Adjacent d) Percolate down (iv) A collision strategy in which the hash table is an array or vector of linked lists that store the items is known as . a) Linear Probing b) Separate Chaining c) Quadratic Probing d) Double Hashing (v) Which of the following is nonlinear data structure ? a) Stack b) Queue c) Array d) Graph 1 (vi) A node that have no children is called . a) Siblings b) Leaf c) an Edge d) a Cycle (vii) Height of the given tree is . a) 1 b) 2 c) 3 d) 4 (viii) In a Binary Tree, any node can have maximum of children. a) 0 b) 1 c) 2 d) 3 (ix) An array or vector can be used to store a heap efficiently because a heap is a a) Complete b) Red Black c) B+ d) B (x) Secondary clustering happens due to . a) Linear Probing b) Quadratic Probing c) Double Hashing d) Separate Chaining 2 tree. (i) The worst-case computing time of binary search is O___________________. a) n b) nlog2n c) log2n d) n2 (ii) The ___________________ solves the single-source shortest path problem for a nonnegative weighted graph. a) Graph theory b) Breadth First Search c) Depth first search d) Dijikstra’s Algorithm (iii) The process of swapping an element with its parent, in order to restore the heap order property is called: a) Enqueue b) Queue c) Percolate up d) Percolate down (iv) In Depth First Search graph traversal algorithm, which of the following data structure is used? a) Stack b) Queue c) Linked List d) Integer (v) The case of two items needing to be placed at the same location in hash table is called ______. a) Hashing b) Collision c) Overlapping d) Clustering (vi) Two Nodes that have the same parent is called _____. a) Leaf b) Siblings c) an Edge d) a Cycle 3 (vii) To represent hierarchical relationship between elements, which data structure is suitable? a) Graph b) Priority Queue c) Tree d) Stack (viii) A Binary tree, in which each any node can have maximum ________ children. a) 0 b) 1 c) 2 d) 3 (ix) An array or vector can be used to store a heap efficiently because a heap is a _____ tree. a) Complete b) Red Black c) B+ d) B (x) Best case complexity of Linear Search is O _____ a) n b) n+1 c) 1 d) log2n 1. The case of two items needing to be placed at the same location in hash table is called _ Collision___. 2. An Algorithm’s efficiency is express in terms of 3. Another name for an AVL tree is 4. time and space . Height balanced tree. Priority Queue is a collection of data elements (all of the same type) in which a certain priority is associated with each data item. 5. The worst-case computing time of Linear Search is O (__n__). 6. Primary clustering happens due to___Linear Probing_____. 7. Linear probing is a method for dealing with ____Collisions____. 8. Considering the Addition rule of Big O notation, O (100n5+ 2000n4 + 30000n3) = ___n___ 4 Short Questions 2. Write an algorithm for Binary Search. Also find the Worst Case Complexity for Binary Search. Ans: Page no 556 and Worse Case is O (log n to base 2) page no 557 3. Write an algorithm for Heapsort. Ans: Page no 744 and worse case is O (nlog n to base 2) 4. Define Binary Search Tree with suitable example. Ans: page no 667 and best examples page number 667 5. Write the Depth First Search algorithm in detail. Also find the Breadth First Traversal for the following Graph (starting with node 4. Ans: page no 896 and BFS: 4 1 3 0 2 DFS: 4 1 0 2 3 6. Draw the binary tree that represents the following expression and then use traversal to find the equivalent prefix and postfix expression. A / (B – (C – (D – (E – F)))) Ans: page no 666 problem number 12 7. Explain AVL tree with suitable example. Ans: page number 841 5 8. What two criteria are usually used to measure an algorithm’s efficiency? From the following given algorithm, find the Computing time for the algorithm. /* Algorithm to find the mean of x[0],.. . x[n+1] */ 1. Initialize sum = 0. 2. Initialize index variable i = 0. 3. while i < n+2do the following: 4. a. Add x[i] to sum. 5. b. sum=sum + i 6. c. Increment i by 1. End while. 7. Calculate and return mean = sum / ( n+2). Answer Initialize sum = 0. Initialize index variable i= 0. while i< n+2do the following: a. Add x[i] to sum. b. sum=sum+i c. Increment i by 1. o End while. Calculate and return mean = sum / (n+2). 1 1 n+3 n+2 n+2 n+2 1 Answer: T(n) = 1+1 +n +3 +n +2+n+2+n +2+1 T(n) = 4n + 12 T(n) is O(n) Page no 552 6 9. Question a-e refer to the following binary tree: a. List all the leaves b. Is the binary tree complete? c. Find the height of the tree. d. Is this binary tree balanced? If not, explain why it isn’t. e. Show the array used to represent the binary tree 10. Define Binary Search Tree with suitable example. Answer: Page No 667 11. Write the Breadth First Search algorithm in detail. Also, find the Breadth First Traversal for the following Graph (starting with node 2). Ans: 2 4 5 3 6 7 7 12. Write the preorder traversal algorithm for a binary tree. Perform an inorder and preorder traversal for the following binary tree. Answer : Pre – Order: NLR FBADCEGIH In – Order: L N R ABCDEFGHI 13. Construct a binary search tree with the key elements 55 , 33 , 77, 22, 11 , 44 , 88 , 66 , 99 in the given order. Show the tree and balance factor for each node before and after each rebalancing. Answer: AVL Trees Refer to Exercise Solutions in Text Book 8 Long Questions 1. Construct a binary search tree with the key elements 55, 33 , 77, 22, 11 , 44 , 88 , 66 , 99 in the given order. Show the tree and balance factor for each node before and after each rebalancing. Ans[1] 9 2. Explain Adjacency Matrix representation. Find the adjacency matrix representation and adjacency list representation for the following directed graph. Ans [2] Adjacency-Matrix Representation There are several common ways of implementing a directed graph using data structures already known to us. One of these is the adjacency matrix of the digraph. To construct it, we first number the vertices of the digraph 1, 2, . . ., n; the adjacency matrix is the n x n matrix adj, in which the entry in row i and column j is 1 (or true) if vertex j is adjacent to vertex i (that is, if there is a directed arc from vertex i to verEptex j), and is 0 (or false) otherwise. (Note: In mathematics, the rows and columns are usually numbered beginning with 1.) For example, the adjacency matrix for the digraph. Adj A 1 2 3 4 5 6 1 0 1 0 0 0 0 2 0 0 1 1 0 0 3 0 0 0 1 1 1 4 0 0 0 0 0 1 5 0 0 0 0 0 0 6 0 0 0 0 0 0 1 0 3. Explain Linear Probing. Using Hash Table with Eleven locations and the hashing function h(i)=i%11, show the hash table that result when the following integers are inserted in the order given : 42, 41, 95, 64, 67, 20, 18, 27, 28 , 80 , 31. Assume that collision are resolved using Linear Probing. Answer [3] Linear Probing One simple strategy for handling collisions is known as linear probing. In this scheme, a linear search of the table begins at the location where a collision occurs and continues until an empty slot is found in which the item can be stored. 0 1 2 3 4 5 6 7 8 9 10 20 67 18 80 31 27 28 95 41 42 64 h(42) = i%11 = 42%11 = 9 h(41) = 41%11 = 41%11= 8 h(95)=95%11 = 7 h(64)= 64%11 = 9 collision = 9+1 = 10 h(67) = 67%11 = 1 h(20) = 20%11 = 9 collision = 9 + 1 = 10 collision = 9 + 2 = 11%11= 0 h(18)= 18%11 = 7 collision = 7 + 1 = (8,9,10,0,1 )collision h(18)= (18+6)%11 = 2 h(27) = 27%11 = 5 h(28) =28%11 = 6 h(80) = 80%11 = 3 h(31) = 31%11 = 9 + 1= (10,0,1,2,3) collision = (31+6) % 11 = 4 1 4. Write the algorithm for Heapsort.Sort the following list using Heapsort 35,15,77,60,22,41. Answer [4] Heap Sort Chapter 5. Explain Adjacency Matrix representation.Find the adjacency matrix representation and adjacency list representation for the following directed graph. 10. Explain Quadratic Probing. Using Hash Table with Fourteen locations and the hashing function h(i)=i%14, show the hash table that result when the following integers are inserted in the order given : 42, 41, 45, 64, 67, 20, 18, 26, 28 ,70, 31, 16. Assume that collision are resolved using Quadratic Probing 1
© Copyright 2026 Paperzz