1.

What is the time complexity to insert a node based on position in a priority queue?(a) O(nlogn)(b) O(logn)(c) O(n)(d) O(n^2)My query is from Priority Queue in portion Abstract Data Types of Data Structures & Algorithms II have been asked this question in quiz.

Answer»

Right option is (c) O(n)

The explanation is: In the WORST CASE, you MIGHT have to TRAVERSE the ENTIRE list.



Discussion

No Comment Found

Related InterviewSolutions