Question 7675 – UGC-NET DEC-2019 Part-2
November 27, 2023UGC-NET DEC-2019 Part-2
November 27, 2023UGC-NET DEC-2019 Part-2
Question 13 |
What is the worst case running time of Insert and Extract-min, in an implementation of a priority queue using an unsorted array? Assume that all insertions can be accommodated.
θ(1) , θ(n) | |
θ(n) , θ(1) | |
θ(1) , θ(1) | |
θ(n) , θ(n) |
Question 13 Explanation:
Insertion will remain the same for best,average and worst case time complexities. It will take a constant amount of time only.
Extract-Min will take θ(n) time for above conditions. The array is unsorted there is naturally no better algorithm than just linear search. Worst case performance for linear search is Θ(n)
Extract-Min will take θ(n) time for above conditions. The array is unsorted there is naturally no better algorithm than just linear search. Worst case performance for linear search is Θ(n)
Correct Answer: A
Question 13 Explanation:
Insertion will remain the same for best,average and worst case time complexities. It will take a constant amount of time only.
Extract-Min will take θ(n) time for above conditions. The array is unsorted there is naturally no better algorithm than just linear search. Worst case performance for linear search is Θ(n)
Extract-Min will take θ(n) time for above conditions. The array is unsorted there is naturally no better algorithm than just linear search. Worst case performance for linear search is Θ(n)