Which of the following data structure can provide efficient searching of the elements?

Which of the following data structure can provide efficient searching of the elements?
A. unordered lists
B. binary search tree
C. treap
D. 2-3 tree
 
Answer: d
Explanation: The average case time for lookup in a binary search tree, treap and 2-3 tree is O(log n) and in unordered lists it is O(n). But in the worst case, only the 2-3 trees perform lookup efficiently as it takes O(log n), while others take O(n).
 

Tìm kiếm

Back
Top