Data Structures & AlgorithmsHardInfosys · Trees

A complete binary tree with 53 nodes is stored in a 1-indexed array (children of i are 2i and 2i+1). How many descendants does the node at index 12 have?

  1. A. 6
  2. B. 4
  3. C. 5
  4. D. 8

Correct answer: A. 6

Children 24 and 25, and their children 48, 49, 50, 51 exist (all <= 53); the next level (96 and above) does not, so 6 descendants.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic