class MaxHeap { constructor() { this.heap = []; } getParentIndex(index) { return Math.floor((index - 1) / 2); } getLeftChildIndex(index) { return 2 * index + 1; } getRightChildIndex(index) { return 2 * index + 2; } swap(index1, index2) { [this.heap[index1], this.heap[index2]] = [this.heap[index2], this.heap[index1]]; } insert(value) { this.heap.push(value); this.h..