Solution: Heaps

Review the solution that implements the remove(i) method in the binary heap.

We'll cover the following


Implement the remove(i) method, that removes the value stored in a[i] in a BinaryHeap. This method should run in O(logn)O(\log n) time.


The given code represents a class called BinaryHeap that implements a binary heap data structure. The BinaryHeap class has a remove() method that removes an element from the heap at a specified index.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy