Why priority_queue is priority_queue implemented using heaps when without using heaps too we can implement it with just vectors.
Suppose we use vector as a queue and keep the elements in decreasing order. We can use this as priority queue.
For insertion : We can use binary search . Complexity O(logN)
For deletion : Here also we can use binary search. Complexity O(logN)
For top element : O(1)
In additonaddition, we can have access kth maximum element in just O(1) time which is not the case with heaps .
Then , why do we use heaps for implementing priority queues.?