# Data Structures and Algorithms Multiple Choice Questions - Set 3

21.       Which of the following algorithm is not stable?
(A) Bubble Sort
(B) Quick Sort
(C) Merge Sort
(D) Insertion Sort
22.       An algorithm that requires ................... operations to complete its task on n data elements is said to have a linear runtime.
(A) n3 + 9
(B) 3n2 + 3n + 2
(C) 2n + 1
(D) 9
23.       The in-order traversal of a binary tree is HFIEJGZ, and the post-order traversal of the same tree is HIFJZGE. What will be the total number of nodes in the left sub tree of the given tree? (It is NOT a search tree)
(A) 1
(B) 2
(C) 3
(D) 4
24.       The complexity of adding two matrices of order m*n is
(A) m + n
(B) mn
(C) max(m, n)
(D) min(m, n)
25.       Which method can find if two vertices x & y have path between them?
(A) Depth First Search
(C) Both (A) & (B)
(D) None (A) or (B)
26.       If we choose Prim's Algorithm for uniquely weighted spanning tree instead of Kruskal's Algorithm, then
(A) we will get a different spanning tree.
(B) we will get the same spanning tree.
(C) spanning will have less edges.
(D) spanning will not cover all vertices.
Explanation
Regardless of which algorithm is used, in a graph with unique weight, resulting spanning tree will be same.
27.       The second largest number from a set of n distinct numbers can be found in
(A) O(n)
(B) O(2n)
(C) O(n2)
(D) O(log n)
28.       If the in-order and pre-order traversal of a binary tree are D,B,F,E,G,H,A,C and A,B,D,E,F,G,H,C respectively then the post-order traversal of that tree is
(A) D,F,G,A,B,C,H,E
(B) F,H,D,G,E,B,C,A
(C) C,G,H ,F,E,D,B,A
(D) D,F,H,G,E,B,C,A
29.       In a binary tree, the number of terminal or leaf nodes is 10. The number of nodes with two children is
(A) 9
(B) 11
(C) 25
(D) 20