# Heap and Priority Queue

They are the built-in form of a tree, which stores all the elements in a particular order.
There are majorly two types of Heaps or priority queues that came into action:
Min-Heap:
Elements are stored in such a way that the minimum element will always be on the top.
Max-Heap:
Elements are stored in such a way that the maximum element will always be on the top.
The time complexity of push and pop operations in heaps and priority queues is O(log(N)) and it requires O(N) space.

## Top Problems related to Heap and Priority Queue

Insertion in a Priority queue -Max Heap

Running Median

Convert Min-Heap to Max-Heap

Last Stone Weight

String Transformation

Fourth Largest Element in the Array

K Most Frequent Words

Sorted Matrix

Minimum K product

Gary and multiplication

Kth largest element

Minimum Character Deletion

Rearrange The Array

Matrix Median

Permutations

Kth largest element in the unsorted array

Kth Smallest Element

Meetings II

K-th Largest Sum Subarray

Magician and Chocolates

Median in a stream