LC 1046 My two cents: Each push and pop requires a rearrangement of the existing elements, it's almost like the priority queue is a living organism which evolves / devolves it self to maintain the order of the elements. Swap, BubbleUp, & BubbleDown are the methods doing the main lifting. Here, swap is the simple swap operation const temp: T = this.heap[i]; this.heap[i] = this.heap[j]; this.heap[j] = temp The this.compare dependency injection is the soul of th...