What is the space complexity of a treap algorithm?

Category: QuestionsWhat is the space complexity of a treap algorithm?
Editor">Editor Staff asked 1 month ago

What is the space complexity of a treap algorithm?
 
(a) O(N)
 
(b) O(log N)
 
(c) O(log N)
 
(d) O(N^2)
 
The above asked question is from Binary Trees in section Binary Trees of Data Structures & Algorithms I
 
The question was asked during an interview.

1 Answers
Editor">Editor Staff answered 1 month ago

The correct answer is (a) O(N)
 
The explanation is: The average case and worst case space complexity of a treap is mathematically found to be O(N).