Which of the following is an advantage of balanced binary search tree, like AVL tree, compared to binary heap?

Category: QuestionsWhich of the following is an advantage of balanced binary search tree, like AVL tree, compared to binary heap?
Editor">Editor Staff asked 4 weeks ago

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 Answers
Editor">Editor Staff answered 4 weeks ago

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