What is the time complexity for maintaining a dynamic set of weighted trees?

Category: QuestionsWhat is the time complexity for maintaining a dynamic set of weighted trees?
Editor">Editor Staff asked 1 month ago

What is the time complexity for maintaining a dynamic set of weighted trees?
 
(a) O (n)
 
(b) O (n^2)
 
(c) O (log n)
 
(d) O (n!)
 
This is a very interesting question from Binary Trees in section Binary Trees of Data Structures & Algorithms I
 
I have been asked this question at a job interview.

1 Answers
Editor">Editor Staff answered 1 month ago

The correct option is (c) O (log n)
 
The best I can explain: A lot of applications have been implemented using Top tree interface. Maintaining a dynamic set of weighted trees is one such application which can be implemented with O (log n) time complexity.