1.

What is the time complexity for the initialization of top tree?(a) O (n)(b) O (n^2)(c) O (log n)(d) O (n!)Question is taken from Binary Trees in section Binary Trees of Data Structures & Algorithms IThe question was asked during an interview for a job.

Answer»

Right answer is (a) O (n)

BEST explanation: GENERALLY, trees have weight on its edges. ALSO there is one to one correspondence of the edges with the TOP trees. Therefore, top trees can be INITIALIZED in O (n) time.



Discussion

No Comment Found

Related InterviewSolutions