What is the worst-case time complexity of inserting an element in a heap of…
2026
What is the worst-case time complexity of inserting an element in a heap of size n ?
- A.
O(1)
- B.
O(log n)
- C.
O(n)
- D.
O(n log n)
Attempted by 101 students.
Show answer & explanation
Correct answer: B
The worst-case time complexity of inserting an element in a heap of size n is O(log n).