All mock tests are FREE till 31 December — register to save your progress
Unit 7 · Data Structures and Algorithms Paper 2 CS · December 2023

Which of the following is TRUE?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: A. The cost of searching an AVL tree is Θ(log n) but that of a binary search tree is O(n)

Explanation

An AVL tree stays balanced, so search is Θ(log n). An unbalanced BST can degenerate into a chain, so its worst case is O(n).

More Data Structures and Algorithms questions