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
- 2-3-4 trees are B - trees of order 4. They are isometric of trees.
- Match List I with List II. List I: A. Parallel FFT, B. Iterative FFT, C. Evaluation of a polynomial at n points by Horner's method, D. Prod…
- Let f(n) and g(n) be asymptotically positive functions. Statement I: f(n) ≥ 1 and f(n) = O(g(n)) ⇒ g(n) = Ω(f(n)). Statement II: f(n) = O(g…
- A. If some NP-complete problem P is in 𝒫, then 𝒫 = 𝒩𝒫. B. TSP is in 𝒩𝒫. C. SAT is in 𝒩𝒫. D. The Hamiltonian circuit problem is not NP-compl…
- Suppose a circular queue of capacity n-1 elements is implemented with an array of n elements. Assume that the insertion and deletion operat…
- Given below are two statements: one is labelled as Assertion A and the other is labelled as Reason R. Assertion A: The AVL trees are more b…