0 votes 0 votes Is priority queue work efficiently with sorted array than unsorted array and heap for insertion and deletion operation? Then why do we apply priority queue in heap specially DS data-structures priority-queue queue + – srestha asked Dec 22, 2018 srestha 599 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply Shobhit Joshi commented Dec 22, 2018 reply Follow Share Heap : Insertion O(logn), Deletion O(logn) Sorted array : Insertion O(n), Deletion O(1) Unsorted array : Insertion O(1), Deletion O(n) As we are implementing priority queue we will insert and remove the highest priority element, not any random element and searching for any random element is of least concern as we care only about the highest priority, so heap will be best suited for this purpose. That's what i think. 0 votes 0 votes shraddha priya commented Jan 10, 2019 reply Follow Share How is deletion in sorted array O(1)? After the element is deleted , don't we need to shift all elements to fill the gap caused due to deletion? 1 votes 1 votes Please log in or register to add a comment.