Min-Heap implementation in Java is represented by PriorityQueue which, in turn, is backed by transient Object[] queue;
The quote from its javadoc is
Priority queue represented as a balanced binary heap: the two children of queue[n] are queue[2n+1] and queue[2(n+1)].
Why not queue[2n] and queue[2n+1] as Tim Roughgarden states here https://www.coursera.org/learn/algorithms-graphs-data-structures/lecture/KKqlm/heaps-implementation-details-advanced-optional 08:00?
PriorityQueuein java :) but if we would use2nand2n+1we would get0and1which is not correct. Using2nand2n + 1works for languages where indexes start at 1, but in Java they start at 0, that's the reason - Denis Zavedeev