1.

What is the time complexity for creating a ternary heap using swapping?(a) O (log n/ log 3)(b) O (n!)(c) O (n)(d) O (1)The question is from Ternary heap in chapter Heap of Data Structures & Algorithms IThe question was posed to me in class test.

Answer»

The correct answer is (C) O (n)

The explanation is: Ternary Heap can be formed by TWO swapping operations. Therefore, the TIME complexity for creating a ternary heap using two swapping operation is FOUND to be O (n).



Discussion

No Comment Found

Related InterviewSolutions