+1 vote
in Data Structures & Algorithms I by (110k points)
Which of the following is an advantage of balanced binary search tree, like AVL tree, compared to binary heap?

(a) insertion takes less time

(b) deletion takes less time

(c) searching takes less time

(d) construction of the tree takes less time than binary heap

Question is from Binary Trees topic in portion Binary Trees of Data Structures & Algorithms I

The question was asked by my school teacher while I was bunking the class.

1 Answer

+1 vote
by (672k points)
selected by
Best answer
The correct choice is (a) insertion takes less time

Best explanation: Insertion and deletion, in both the binary heap and balanced binary search tree takes O(log n). But searching in balanced binary search tree requires O(log n) while binary heap takes O(n). Construction of balanced binary search tree takes O(nlog n) time while binary heap takes O(n).

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.