A scheme for storing binary trees in an array X is as follows. Indexing of X…

GATE · 2006 · CS

A scheme for storing binary trees in an array X is as follows. Indexing of X starts at 1 instead of 0. the root is stored at X[1]. For a node stored at X[i], the left child, if any, is stored in X[2i] and the right child, if any, in X[2i+1]. To be able to store any binary tree on n vertices the minimum size of X should be.

  1. A.

    log2n

  2. B.

    n

  3. C.

    2n + 1

  4. D.

    2n - 1

Attempted by 304 students.

Show answer

Correct answer: D

The worked solution is available to enrolled students.

Video solution available to enrolled students.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…