The worst case running time to search for an element in a balanced in a binary search tree with n2^n elements is
(A)
(B)
(C)
(D)
(A)
A
(B)
B
(C)
C
(D)
D
Answer: (C)
Explanation:
Time taken to search an element is where h is the height of Binary Search Tree (BST). The growth of height of a balanced BST is logarithmic in terms of number of nodes. So the worst case time to search an element would be which is Which is which can be written as .
Quiz of this Question
Please comment below if you find anything wrong in the above post
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 neveropen!