heap is a specialized tree-based data structure which is essentially an almost complete tree that satisfies the heap property either:

  • max heap - the value of every parent node is greater than its children
  • min heap - the value of every parent node is lesser than its children

Heap Implementations & Their Operation Time-Complexities

Heap Implementation

find-min

delete-min

insert

decrease-key

meld

Binary

Θ(1)

Θ(log n)

O(log n)

O(log n)

Θ(n)

Leftist

Θ(1)

Θ(log n)

Θ(log n)

O(log n)

Θ(log n)

Binomial

Θ(1)

Θ(log n)

Θ(1)

Θ(log n)

O(log n)

Fibonacci

Θ(1)

O(log n)

Θ(1)

Θ(1)

Θ(1)

Pairing

Θ(1)

O(log n)

Θ(1)

o(log n)

Θ(1)

Brodal

Θ(1)

O(log n)

Θ(1)

Θ(1)

Θ(1)

Rank-pairing

Θ(1)

O(log n)

Θ(1)

Θ(1)

Θ(1)

Strict Fibonacci

Θ(1)

O(log n)

Θ(1)

Θ(1)

Θ(1)

2-3 heap

O(log n)

O(log n)

O(log n)

Θ(1)

?