Big O Gym › Problem

Big O Quiz: Binary Heap Push

What is the time complexity of pushing a value onto a binary heap?

Concept: tree-height bound on heap operations

A binary heap is a complete binary tree of height **log n**. Push appends the new value at the bottom and bubbles it up by repeated parent comparisons - at most one swap per level, so **O(log n)** comparisons and swaps.

More Big O practice problems · Today's daily problem