Heap is the underlying implementation of Priority Queue. A heap is implemented using a binary tree. A heap can be visualized to have a tree structure logically but internally it's implemented an array. For a binary heap we have O(log(n)) for insert, O(log(n)) for delete min and heap construction can be done in O(n). SO Searching… Continue reading Heap – Theory

# Category: Heap

## Priority Queue – Theory

Java Docs In computer science, a priority queue is an abstract data type which is like a regular queue or stack data structure, but where additionally each element has a "priority" associated with it. In a priority queue, an element with high priority is served before an element with low priority. If two elements have the same priority, they are served according to their… Continue reading Priority Queue – Theory

## Heap

Min Heap Visualizer Max Heap Visualizer Heap Basics Question List Heap is an almost complete binary tree. Time complexity of building a heap = O(n) (and not O(n(logn))) - SO N – 1 internal nodes in a binary tree with N leaf (external) nodes GFG It would be O(n log n) if you built the heap by repeatedly… Continue reading Heap