GATE | Gate IT 2008 | Question 12

Which of the following is TRUE?

(A) The cost of searching an AVL tree is θ (log n) but that of a binary search tree is O(n)
(B) The cost of searching an AVL tree is θ (log n) but that of a complete binary tree is θ (n log n)
(C) The cost of searching a binary search tree is O (log n ) but that of an AVL tree is θ(n)
(D) The cost of searching an AVL tree is θ (n log n) but that of a binary search tree is O(n)


Answer: (A)

Explanation: AVL tree is a balanced tree.
AVL tree’s time complexity of searching = θ(logn)

But a binary search tree, may be skewed tree, so in worst case BST searching time = θ(n)

Quiz of this Question



My Personal Notes arrow_drop_up


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.