InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 51. |
What are splay trees?(a) self adjusting binary search trees(b) self adjusting binary trees(c) a tree with strings(d) a tree with probability distributionsThis is a very interesting question from Splay Tree topic in chapter Binary Trees of Data Structures & Algorithms IThe question was posed to me in homework. |
|
Answer» The correct option is (a) self adjusting BINARY SEARCH TREES |
|
| 52. |
What is the time complexity for maintaining a dynamic set of weighted trees?(a) O (n)(b) O (n^2)(c) O (log n)(d) O (n!)This is a very interesting question from Binary Trees in section Binary Trees of Data Structures & Algorithms II have been asked this question at a job interview. |
|
Answer» The correct option is (C) O (log n) |
|
| 53. |
Which of the following are used as an internal operation in Top tree?(a) Merge(b) Cut(c) Expose(d) LinkThe query is from Binary Trees topic in portion Binary Trees of Data Structures & Algorithms IThis question was addressed to me in a national level competition. |
|
Answer» The correct answer is (a) Merge |
|
| 54. |
Which of the dynamic operations are used in Top Tree data structure implementation?(a) Link(b) Cut(c) Expose(d) All of the mentionedMy doubt stems from Binary Trees topic in portion Binary Trees of Data Structures & Algorithms II have been asked this question in an internship interview. |
|
Answer» The CORRECT option is (d) All of the mentioned |
|
| 55. |
Which property makes top tree a binary tree?(a) Nodes as Cluster(b) Leaves as Edges(c) Root is Tree Itself(d) All of the mentionedAsked question is from Binary Trees topic in portion Binary Trees of Data Structures & Algorithms II had been asked this question in examination. |
|
Answer» Correct answer is (d) All of the mentioned |
|
| 56. |
How many top trees are there in a tree with single vertex?(a) 0(b) 1(c) 2(d) 3I'm obligated to ask this question of Binary Trees topic in division Binary Trees of Data Structures & Algorithms II got this question in examination. |
|
Answer» The CORRECT OPTION is (a) 0 |
|
| 57. |
What is the time complexity for the initialization of top tree?(a) O (n)(b) O (n^2)(c) O (log n)(d) O (n!)Question is taken from Binary Trees in section Binary Trees of Data Structures & Algorithms IThe question was asked during an interview for a job. |
|
Answer» Right answer is (a) O (n) |
|
| 58. |
Is Top tree used for maintaining Dynamic set of trees called forest.(a) True(b) FalseThe above asked question is from Binary Trees topic in chapter Binary Trees of Data Structures & Algorithms IThis question was posed to me during an interview. |
|
Answer» Correct answer is (a) True |
|
| 59. |
If A ꓵ B (A and B are two clusters) is a singleton set then it is a Merge able cluster.(a) True(b) FalseThe query is from Binary Trees topic in division Binary Trees of Data Structures & Algorithms IThis question was posed to me in exam. |
|
Answer» Right OPTION is (a) True |
|
| 60. |
Which data structure is used to maintain a dynamic forest using a link or cut operation?(a) Top Tree(b) Array(c) Linked List(d) StackMy question is taken from Binary Trees topic in division Binary Trees of Data Structures & Algorithms II got this question in examination. |
|
Answer» Right option is (a) TOP Tree |
|
| 61. |
How many edges are present in Edge cluster?(a) 0(b) 1(c) 2(d) 4This intriguing question originated from Binary Trees topic in portion Binary Trees of Data Structures & Algorithms IThis question was posed to me during an internship interview. |
|
Answer» Correct answer is (B) 1 |
|
| 62. |
How many edges does a leaf cluster contain?(a) 0(b) 1(c) 2(d) 3This intriguing question originated from Binary Trees topic in chapter Binary Trees of Data Structures & Algorithms II got this question in exam. |
|
Answer» Correct option is (a) 0 |
|
| 63. |
How many edges are present in path cluster?(a) 2(b) 3(c) 6(d) 1This intriguing question comes from Binary Trees topic in portion Binary Trees of Data Structures & Algorithms IThe question was asked in final exam. |
|
Answer» Right choice is (a) 2 |
|
| 64. |
For how many vertices in a set, is top tree defined for underlying tree?(a) 3(b) 4(c) 5(d) 2My enquiry is from Binary Trees in chapter Binary Trees of Data Structures & Algorithms II have been asked this question in an interview for job. |
|
Answer» Right answer is (d) 2 |
|
| 65. |
Which algorithm is used in the top tree data structure?(a) Divide and Conquer(b) Greedy(c) Backtracking(d) BranchMy question comes from Binary Trees topic in chapter Binary Trees of Data Structures & Algorithms IThis question was addressed to me in examination. |
|
Answer» Right ANSWER is (a) Divide and Conquer |
|
| 66. |
When to choose Red-Black tree, AVL tree and B-trees?(a) many inserts, many searches and when managing more items respectively(b) many searches, when managing more items respectively and many inserts respectively(c) sorting, sorting and retrieval respectively(d) retrieval, sorting and retrieval respectivelyQuery is from Red Black Tree topic in division Binary Trees of Data Structures & Algorithms IThis question was addressed to me during a job interview. |
|
Answer» The correct OPTION is (a) many inserts, many SEARCHES and when managing more ITEMS respectively |
|
| 67. |
How can you save memory when storing color information in Red-Black tree?(a) using least significant bit of one of the pointers in the node for color information(b) using another array with colors of each node(c) storing color information in the node structure(d) using negative and positive numberingI'm obligated to ask this question of Red Black Tree in portion Binary Trees of Data Structures & Algorithms IThis question was posed to me in homework. |
|
Answer» CORRECT choice is (a) using least significant bit of one of the pointers in the node for color information Easiest explanation - The node pointers can be used to STORE color with the help of significant bits. the exceptions of this method are in LANGUAGES LIKE java where pointers are not used this may not work. |
|
| 68. |
Why Red-black trees are preferred over hash tables though hash tables have constant time complexity?(a) no they are not preferred(b) because of resizing issues of hash table and better ordering in redblack trees(c) because they can be implemented using trees(d) because they are balancedMy question comes from Red Black Tree in chapter Binary Trees of Data Structures & Algorithms IThis question was addressed to me during an interview for a job. |
|
Answer» Correct option is (b) because of resizing issues of hash table and BETTER ordering in redblack trees |
|
| 69. |
When it would be optimal to prefer Red-black trees over AVL trees?(a) when there are more insertions or deletions(b) when more search is needed(c) when tree must be balanced(d) when log(nodes) time complexity is neededQuestion is taken from Red Black Tree topic in division Binary Trees of Data Structures & Algorithms II had been asked this question in an international level competition. |
|
Answer» Correct OPTION is (a) when there are more insertions or deletions |
|
| 70. |
Which of the following is an application of Red-black trees and why?(a) used to store strings efficiently(b) used to store integers efficiently(c) can be used in process schedulers, maps, sets(d) for efficient sortingI'd like to ask this question from Red Black Tree topic in section Binary Trees of Data Structures & Algorithms IThis question was addressed to me in an online interview. |
|
Answer» The correct option is (c) can be USED in process schedulers, maps, sets |
|
| 71. |
What are the operations that could be performed in O(logn) time complexity by red-black tree?(a) insertion, deletion, finding predecessor, successor(b) only insertion(c) only finding predecessor, successor(d) for sortingQuery is from Red Black Tree in division Binary Trees of Data Structures & Algorithms IThis question was posed to me in unit test. |
|
Answer» CORRECT option is (a) INSERTION, deletion, FINDING predecessor, successor The explanation is: We impose restrictions to achieve logarithm time complexities. impose restrictions are: . root property is black . every leaf is black . CHILDREN of red node are black . all leaves have same black. |
|
| 72. |
What is the special property of red-black trees and what root should always be?(a) a color which is either red or black and root should always be black color only(b) height of the tree(c) pointer to next node(d) a color which is either green or blackI'm obligated to ask this question of Red Black Tree in chapter Binary Trees of Data Structures & Algorithms IThe question was asked in a job interview. |
|
Answer» Right option is (a) a COLOR which is either red or black and root should always be black color only |
|
| 73. |
Elements in a tree can be indexed by its position under the ordering of the keys and the ordinal position of an element can be determined, both with good efficiency.(a) true(b) falseThis interesting question is from Weight Balanced Tree topic in division Binary Trees of Data Structures & Algorithms IThe question was asked during an internship interview. |
|
Answer» RIGHT option is (a) true To explain: In a WEIGHT balanced TREE we can EVEN store the key information so as to use as a key VALUE pair. |
|
| 74. |
Consider a weight balanced tree such that, the number of nodes in the left sub tree is at least half and at most twice the number of nodes in the right sub tree. The maximum possible height (number of nodes on the path from the root to the farthest leaf) of such a tree on k nodes can be described as(a) log2 n(b) log4/3 n(c) log3 n(d) log3/2 nThe above asked question is from Weight Balanced Tree in section Binary Trees of Data Structures & Algorithms II got this question by my college director while I was bunking the class. |
|
Answer» RIGHT OPTION is (d) log3/2 n Best explanation: Total NUMBER of nodes can be described by the recurrence T(n) = T((n-1)/3)) + T(2(n-1)/3) + 1 T(1) = 1. height of the tree will be H(n) = H(2/3(n-1)) + 1, H(1). drawing a recurrence tree and the COST at each level is 1 and the height will be log(3/2)n. |
|
| 75. |
What are the operations that can be performed on weight balanced tree?(a) all basic operations and set intersection, set union and subset test(b) all basic operations(c) set intersection, set union and subset test(d) only insertion and deletionMy enquiry is from Weight Balanced Tree topic in section Binary Trees of Data Structures & Algorithms II got this question in quiz. |
|
Answer» The CORRECT answer is (a) all basic operations and set intersection, set union and subset test |
|
| 76. |
What is the condition for a tree to be weight balanced. where a is factor and n is a node?(a) weight[n.left] >= a*weight[n] and weight[n.right] >= a*weight[n].(b) weight[n.left] >= a*weight[n.right] and weight[n.right] >= a*weight[n].(c) weight[n.left] >= a*weight[n.left] and weight[n.right] >= a*weight[n].(d) weight[n] is a non zeroMy question is taken from Weight Balanced Tree topic in section Binary Trees of Data Structures & Algorithms IThis question was addressed to me during an interview. |
|
Answer» Right option is (a) weight[n.left] >= a*weight[n] and weight[n.right] >= a*weight[n]. |
|
| 77. |
A node of the weight balanced tree has(a) key, left and right pointers, size(b) key, value(c) key, size(d) keyThe doubt is from Weight Balanced Tree topic in section Binary Trees of Data Structures & Algorithms IThis question was addressed to me in an online interview. |
|
Answer» CORRECT option is (a) key, left and right pointers, size Best explanation: As a weight balanced tree stores HEIGHT of the subtrees, we need to use size as an ADDITIONAL attribute to every node. ALSO value(for MAPPINGS) may be an optional attribute. |
|
| 78. |
What are the applications of weight balanced tree?(a) dynamic sets, dictionaries, sequences, maps(b) heaps(c) sorting(d) storing stringsThis intriguing question originated from Weight Balanced Tree in chapter Binary Trees of Data Structures & Algorithms IThis question was posed to me in semester exam. |
|
Answer» Right answer is (a) dynamic SETS, dictionaries, SEQUENCES, maps |
|
| 79. |
What is a weight balanced tree?(a) A binary tree that stores the sizes of subtrees in nodes(b) A binary tree with an additional attribute of weight(c) A height balanced binary tree(d) A normal binary treeMy question is based upon Weight Balanced Tree topic in portion Binary Trees of Data Structures & Algorithms IThis question was addressed to me in quiz. |
|
Answer» Correct ANSWER is (a) A binary TREE that stores the SIZES of subtrees in nodes |
|
| 80. |
Cartesian trees solve range minimum query problem in constant time.(a) true(b) falseThe above asked question is from Cartesian Tree topic in section Binary Trees of Data Structures & Algorithms IThis question was addressed to me during an internship interview. |
|
Answer» The correct answer is (a) true |
|
| 81. |
A treap is a cartesian tree with ___________(a) additional value, which is a priority value to the key generated randomly(b) additional value, which is a priority value to the key generated sequentially(c) additional heap rule(d) additional operations like remove a range of elementsThe query is from Cartesian Tree in portion Binary Trees of Data Structures & Algorithms IThe question was asked by my school teacher while I was bunking the class. |
|
Answer» Right choice is (a) additional value, which is a priority value to the key generated randomly |
|
| 82. |
Cartesian trees are most suitable for?(a) searching(b) finding nth element(c) minimum range query and lowest common ancestors(d) self balancing a treeI need to ask this question from Cartesian Tree in chapter Binary Trees of Data Structures & Algorithms IThe question was posed to me in quiz. |
|
Answer» Correct option is (c) minimum range QUERY and lowest common ancestors |
|
| 83. |
Consider a sequence of numbers to have repetitions, how a cartesian tree can be constructed in such situations without violating any rules?(a) use any tie-breaking rule between repeated elements(b) cartesian tree is impossible when repetitions are present(c) construct a max heap in such cases(d) construct a min heap in such casesI'd like to ask this question from Cartesian Tree topic in section Binary Trees of Data Structures & Algorithms IThis question was posed to me by my school teacher while I was bunking the class. |
|
Answer» CORRECT answer is (a) use any tie-breaking rule between repeated elements To explain: Consider any of the tie breaking RULES, for EXAMPLE the element which appears first can be taken as small among the same elements and then apply CARTESIAN tree rules. |
|
| 84. |
What is the speciality of cartesian sorting?(a) it sorts partially sorted set of data quickly(b) it considers cartesian product of elements(c) it sorts elements in less than O(logn)(d) it is a self balancing treeI'd like to ask this question from Cartesian Tree in portion Binary Trees of Data Structures & Algorithms IThis question was addressed to me in exam. |
|
Answer» Right choice is (a) it sorts partially sorted set of DATA quickly |
|
| 85. |
Is the below tree representation of 50,100,400,300,280 correct way to represent cartesian tree?(a) true(b) falseQuery is from Cartesian Tree topic in section Binary Trees of Data Structures & Algorithms IThis question was posed to me in class test. |
|
Answer» The correct choice is (a) true |
|
| 86. |
What is a Cartesian tree?(a) a skip list in the form of tree(b) a tree which obeys cartesian product(c) a tree which obeys heap property and whose inorder traversal yields the given sequence(d) a tree which obeys heap property onlyMy question is taken from Cartesian Tree topic in section Binary Trees of Data Structures & Algorithms II got this question in homework. |
|
Answer» The correct OPTION is (c) a tree which obeys heap property and WHOSE inorder traversal yields the GIVEN sequence |
|
| 87. |
Why to prefer red-black trees over AVL trees?(a) Because red-black is more rigidly balanced(b) AVL tree store balance factor in every node which costs space(c) AVL tree fails at scale(d) Red black is more efficientThis key question is from AVL Tree topic in section Binary Trees of Data Structures & Algorithms IThe question was asked in an online interview. |
|
Answer» The correct choice is (b) AVL tree store balance factor in every node which costs space |
|
| 88. |
What maximum difference in heights between the leafs of a AVL tree is possible?(a) log(n) where n is the number of nodes(b) n where n is the number of nodes(c) 0 or 1(d) atmost 1My doubt is from AVL Tree in section Binary Trees of Data Structures & Algorithms IThis question was posed to me in an interview. |
|
Answer» Correct choice is (a) LOG(n) where n is the number of nodes |
|
| 89. |
Given an empty AVL tree, how would you construct AVL tree when a set of numbers are given without performing any rotations?(a) just build the tree with the given input(b) find the median of the set of elements given, make it as root and construct the tree(c) use trial and error(d) use dynamic programming to build the treeQuestion is taken from AVL Tree topic in portion Binary Trees of Data Structures & Algorithms IThis question was posed to me in an interview. |
|
Answer» Right option is (b) find the median of the SET of elements GIVEN, MAKE it as root and construct the tree |
|
| 90. |
To restore the AVL property after inserting a element, we start at the insertion point and move towards root of that tree. is this statement true?(a) true(b) falseThis question is from AVL Tree in division Binary Trees of Data Structures & Algorithms IThis question was addressed to me in homework. |
|
Answer» The correct option is (a) true |
|
| 91. |
What is the maximum height of an AVL tree with p nodes?(a) p(b) log(p)(c) log(p)/2(d) ^p⁄2Origin of the question is AVL Tree topic in chapter Binary Trees of Data Structures & Algorithms IThis question was posed to me in an interview. |
|
Answer» Right option is (B) log(P) |
|
| 92. |
Why we need to a binary tree which is height balanced?(a) to avoid formation of skew trees(b) to save memory(c) to attain faster memory access(d) to simplify storingMy question is based upon AVL Tree topic in section Binary Trees of Data Structures & Algorithms IThe question was asked in homework. |
|
Answer» Right answer is (a) to avoid formation of skew trees |
|
| 93. |
What is an AVL tree?(a) a tree which is balanced and is a height balanced tree(b) a tree which is unbalanced and is a height balanced tree(c) a tree with three children(d) a tree with atmost 3 childrenMy question is based upon AVL Tree in chapter Binary Trees of Data Structures & Algorithms IThis question was posed to me in exam. |
|
Answer» Right choice is (a) a TREE which is BALANCED and is a HEIGHT balanced tree |
|
| 94. |
Comparing the speed of execution of Red-Black trees and AA-trees, which one has the faster search time?(a) AA-tree(b) Red-Black tree(c) Both have an equal search time(d) It dependsAsked question is from Binary Trees topic in chapter Binary Trees of Data Structures & Algorithms II got this question in my homework. |
|
Answer» The CORRECT answer is (a) AA-tree |
|
| 95. |
In the given figure, find ‘?’.(a) left rotation(b) right rotation(c) insertion(d) deletionThe origin of the question is Binary Trees topic in section Binary Trees of Data Structures & Algorithms IThe question was posed to me during an internship interview. |
|
Answer» The correct option is (B) RIGHT rotation |
|
| 96. |
What should be the condition for the level of a left node?(a) It should be less than or equal to that of its parent(b) It should be greater than that of its parent(c) It should be strictly less than that of its parent(d) The level should be equal to oneMy enquiry is from Binary Trees topic in portion Binary Trees of Data Structures & Algorithms II got this question by my college director while I was bunking the class. |
|
Answer» The correct choice is (C) It should be strictly less than that of its PARENT |
|
| 97. |
Who is the inventor of AA-Tree?(a) Arne Anderson(b) Daniel Sleator(c) Rudolf Bayer(d) Jon Louis BentleyMy question is from Binary Trees topic in chapter Binary Trees of Data Structures & Algorithms IThis question was addressed to me in an online quiz. |
|
Answer» Right OPTION is (a) ARNE ANDERSON |
|
| 98. |
AA-Trees makes more rotations than a red-black tree.(a) True(b) FalseThis intriguing question comes from Binary Trees in division Binary Trees of Data Structures & Algorithms II have been asked this question at a job interview. |
|
Answer» The CORRECT choice is (a) True |
|
| 99. |
What is the worst case analysis of an AA-Tree?(a) O(N)(b) O(log N)(c) O( N log N)(d) O(N^2)I'm obligated to ask this question of Binary Trees topic in portion Binary Trees of Data Structures & Algorithms II had been asked this question by my college professor while I was bunking the class. |
|
Answer» RIGHT ANSWER is (b) O(log N) The best explanation: The worst case ANALYSIS of an AA-Tree is mathematically FOUND to be O(log N). |
|
| 100. |
Which of the following trees is similar to that of an AA-Tree?(a) Splay Tree(b) B+ Tree(c) AVL Tree(d) Red-Black TreeMy question comes from Binary Trees topic in portion Binary Trees of Data Structures & Algorithms IThis question was addressed to me in an interview for job. |
|
Answer» The correct answer is (d) Red-Black TREE |
|