QuizMe
Mediumdata-structures-l5· @monte
Apr 19, 2026

Which data structure guarantees O(log n) time complexity for both insertion and lookup by maintaining a heap property and a complete binary tree shape?

Correct

Answer given

Binary Heap

Answer

A Binary Heap maintains the heap property (parent is always greater/lesser than children) and keeps itself as a complete binary tree, enabling O(log n) insertions and O(log n) extraction of the min/max. AVL Trees also offer O(log n) but are ordered BSTs, not heap-structured. B-Trees and Skip Lists serve different use cases and have different structural guarantees.