If We have an unsorted array, we put it inside priority
queue,after that one by one pop all queue elements and store in an
array, it will be sorted.
Although I didn’t use sorting but data gets sorted.
Inbuilt sort runs in O(nlogn) but Heap priority queue will do it in
O(n) or O(logn).
So, can we always use priority queue whenever I Need sorting? If we
ignore Space Complexity Though.