In a max-heap, if a node has index i (1-based indexing), what is the index of its parent?

  • AI + 1
  • BI / 2
  • C2 * i
  • DI - 1
Show answerHide answer

Correct answer B

In a max-heap using 1-based indexing, the parent of a node at index i is at index i / 2. The left child of node i is at inde x 2 * i, and the right child is at index 2 * i + 1. This property helps in efficient heap operations like insert and delete. Max-heaps maintain the largest element at the root.