Explore topic-wise InterviewSolutions in .

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

The best EXPLANATION: Splay trees are HEIGHT balanced, self adjusting BST’s.

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)

The best I can EXPLAIN: A LOT of applications have been implemented using Top TREE interface. Maintaining a dynamic set of weighted trees is one such application which can be implemented with O (log n) time complexity.

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

The best EXPLANATION: Link returns a single tree having DIFFERENT vertices from top trees. Cut removes the EDGE from the top tree. Expose is USED to implement queries on top trees. While merge is an internal operation used to merge two clusters and return as a parent cluster.

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

The explanation is: Link returns a single tree having DIFFERENT VERTICES from top trees. Cut removes the edge from the top tree. Expose is used to IMPLEMENT queries on top trees. HENCE all of the options are used as dynamic operations.

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

The best I can explain: TOP tree can be considered as a binary tree if the nodes form a CLUSTER, LEAVES ACT as an EDGE and the root of the top tree acts as a tree itself. Then the top tree is called binary tree.

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

The best EXPLANATION: Tree having a single vertex has no clusters of tree present in the structure. Therefore, there are empty top trees in a tree having a single vertex. Trees with one NODE are single node.

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)

BEST explanation: GENERALLY, trees have weight on its edges. ALSO there is one to one correspondence of the edges with the TOP trees. Therefore, top trees can be INITIALIZED in O (n) time.

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

For explanation: Top tree data STRUCTURE is used to maintain a dynamic FOREST USING link or cut operations. Top tree is a type of data structure which is based on unrooted dynamic BINARY tree and is used to solve path related problems.

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

Explanation: If A ꓵ B is a SINGLETON set where A and B are two clusters, that is there are only ONE NODE that is common between the clusters then they are known as Merge able cluster.

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

Easy explanation - Top tree data STRUCTURE is used to maintain a DYNAMIC forest USING link or cut operations. Top tree is a type of data structure which is based on unrooted dynamic binary tree and is used to SOLVE path related problems.

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

For explanation: A cluster containing only single edge is known as Edge cluster. So there are in total 1 edge present in edge cluster. Cluster in data STRUCTURE is defined as the subtree that is CONNECT having maximum of 2 vertices known as BOUNDARY Vertices.

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

To explain: If a cluster has no EDGES and contains only one vertex KNOWN as boundary vertex then, it is known as leaf cluster. So a leaf cluster doesn’t contain any edges. It is also known as POINT cluster.

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

The best I can EXPLAIN: There are at least 2 edges present in path cluster. Cluster in data structure is defined as the SUBTREE that is connect having maximum of 2 VERTICES known as BOUNDARY Vertices.

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

The BEST I can explain: Top tree is defined for a SET having a maximum of 2 VERTICES for its underlying tree. Those sets having at maximum 2 vertices is CALLED External Boundary Vertices.

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

The best explanation: TOP TREE is a TYPE of data structure which is based on unrooted dynamic binary tree and is used to solve PATH related problems. It allows an algorithm called 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

Easiest EXPLANATION - Red black when frequent inserts and deletes, AVL when less frequent inserts and deletes, B-tree when using paging from a slow storage DEVICE.

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

For explanation: Redblack trees have O(logn) for ordering ELEMENTS in terms of finding first and next elements. also whenever table size increases or DECREASES in hash table you need to perform rehashing which can be very expensive in real time. also red black stores elements in SORTED ORDER rather than input order.

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

For explanation: Though both trees are balanced, when there are more insertions and deletions to make the TREE balanced, AVL trees should have more rotations, it would be BETTER to use red-black. but if more search is required AVL trees should be USED.

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

Easiest explanation - RB tree is used for Linux kernel in the form of completely fair SCHEDULER process SCHEDULING algorithm. It is used for faster insertions, RETRIEVALS.

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

The BEST EXPLANATION: An EXTRA attribute which is a color red or black is used. root is black because if it is red then one of red-black TREE property which states that number of black nodes from root to null nodes must be same, will be violated.

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

Explanation: The speciality of a weight BALANCED tree is a part from basic operations we can perform COLLECTIVE operations LIKE set intersection, which helps in rapid prototyping in functional programming LANGUAGES.

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].

For explanation: The TREE is SAID to be a-balanced if the condition is satisfied. and ‘a’ VALUE will be DETERMINED during tree FORMATION. large value of ‘a’ is more effective.

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

Explanation: They are a type of self balancing TREES which are mostly USED in storing key-value pairs, which is mostly used in functional programming languages. they are very USEFUL to maintain big set of ordered objects.

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

The EXPLANATION is: Unlike AVL and redblack TREES which uses height and color as book keeping information, weight balanced trees use the size of subtrees.

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

The explanation is: Range minmum query is finding the MINIMUM element in a given subarray of an ARRAY. Constant time is achieved by storing the Cartesian trees for all the blocks in the array. Rmq’s are used in STRING MATCHINGS, computing lowest COMMON ancestor and longest common prefix of a sring.

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

For explanation: A cartesian tree, if feeded with a sorted sequence will generate a straight path (or in tree terminology a skew tree). moreover a cartesian tree basing on same values from the search keys DOESNOT work well. so a cartesian tree with priority value in ADDITION to search key is called TREAP.

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

Easiest explanation - In a cartesian TREE minimum value can be found by finding lowest common ancestor for the extreme ELEMENTS. consider 11,9,19,16 the lowest element is 9 and is a lowest common ancestor for 11 and 16. and by applying few techniques cartesian tree can be used to even find lowest common ancestors efficiently.

these can be done in CONSTANT time. tree can be constructed in linear time (this is the most EFFICIENT time for any tree construction) and takes space as many elements are there.

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

The explanation is: It can sort a set which requires only some sorting or DISPLACEMENTS. for EXAMPLE consider 78, 79, 80, 82, 81, 83, In this only 81 and 82 MUST be swaped to make it a complete sorted set, in this case CARTESIAN sort comes to the rescue.

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

The BEST I can explain: A tree with heap property (parent is EITHER small or big than CHILDREN) and when traversed in inorder yields the given input SEQUENCE is called as a cartesian tree. as the above figure satisies both the properties. note that even MIN heap tree can be generated. the above is a max heap tree.

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

The explanation is: A tree with heap property (parent is either small or BIG than children) and when traversed in inorder yields the given input sequence. refer below DIAGRAM question for clarity.

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

The explanation is: Every node in an AVL tree need to store the balance factor (-1, 0, 1) HENCE space costs to O(n), n being number of nodes. but in red-black we can use the SIGN of number (if numbers being stored are only POSITIVE) and hence save space for storing balancing information. there are even other REASONS where redblack is mostly prefered.

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

To EXPLAIN: At every level we can form a TREE with difference in HEIGHT between subtrees to be ATMOST 1 and so there can be log(n) such levels since height of AVL tree is log(n).

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

Easy explanation - Sort the given INPUT, find the median element among them, make it as root and construct left and right subtrees with elements LESSER and greater than the median element recursively. this ensures the subtrees differ only by height 1.

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

Easy explanation - It is INTERESTING to NOTE that after INSERTION, only the path from that POINT to node or only that subtrees are imbalanced interms of HEIGHT.

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)

Easy explanation - Consider height of TREE to be ‘he’, then number of nodes which TOTALS to p can be WRITTEN in terms of height as N(he)=N(he-1)+1+N(he-2). since N(he) which is p can be written in terms of height as the beside recurrence relation which on solving gives N(he)= O(logp) as worst case height.

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

Easy EXPLANATION - In real world dealing with random values is often not POSSIBLE, the probability that u are dealing with NON random values(like SEQUENTIAL) leads to mostly skew trees, which leads to worst case. hence we make height balance by ROTATIONS.

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

Explanation: It is a self balancing tree with height difference ATMOST 1.

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

Easiest EXPLANATION - Since an AA-tree TENDS to be FLATTER, AA-tree has a faster SEARCH time than a Red-Black 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

Easiest explanation - B is INITIALLY the right child of X. It is then ROTATED right side and now, B is the left child of P.

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

For EXPLANATION: The level of a left node should be strictly less than that of its parent. The level of a right node is less than or EQUAL to 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

To explain: AA-tree is INVENTED by Arne Anderson. Daniel Sleator invented Splay Tree. Rudolf Bayer invented a Red-Black tree. Jon Louis BENTLEY invented K-d tree.

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

The BEST explanation: AA- TREES make more rotations than a red-black tree since only two shapes are considered for an AA-Tree whereas SEVEN shapes are considered in Red-Black trees.

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

The BEST explanation: AA- Tree is a SMALL variation of Red-Black tree. AA-Trees overcome the complexity faced in performing insertion and deletion in Red-Black Trees.