Problem Submissions Solution

Binary Heap Operations

Difficulty: Medium

Acceptance: %

Points: 30.00

You are given an initially empty Binary Min Heap and a series of queries. Your task is to implement three methods: insertKey, deleteKey, and extractMin on the Binary Min Heap, and call them as per the query given below:

  • 1 x - This query inserts the element x into the min-heap.
  • 2 x - This query removes the element at position x from the min-heap.
  • 3 - This query removes and prints the minimum element from the min-heap.

Topics

Companies

Articles

Examples:

Expected Time Complexity: O(Q*Log(size of Heap))

Expected Auxiliary Space: O(1)

Constraints:
  • 1 <= Q <= 10^4
  • 1 <= x <= 10^4
Companies:
Amazon Microsoft Samsung Walmart
Topics:
Heap
Locked Content
Access Restricted: Please Login to access the code editor and test cases.