Mission 10: "The Triage System" ⚕️
A critical alert (Priority 99) arrives. Add it to the Max-Heap.
00:00
Mission Objective
Given a `heap` array representing a Max-Heap and a `value` of 99, push the value to the heap and perform one 'bubble-up' swap to restore the heap property. The parent index can be calculated as `Math.floor((index - 1) / 2)`.
Step 1 / 2
1. The Story: The Mission Briefing
"Multiple system alerts are flooding your console simultaneously, each with a different priority level. You must implement a triage system to process the most critical failures first."
2. The Problem
How do you efficiently manage a collection where you always need to access the highest-priority item?
3. The Task
You will implement a Priority Queue using a Max-Heap. You will insert all incoming alerts and then repeatedly extract the maximum-priority alert from the root until the crisis is managed.
4. Concepts Applied
Practical implementation of a Priority Queue using a Heap.