Skip to content
Related Articles

Related Articles

Improve Article

GATE | GATE-CS-2006 | Question 13

  • Last Updated : 28 Jun, 2021

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.
(A) log2n
(B) n
(C) 2n + 1
(D) 2^n — 1


Answer: (D)

Explanation: See Question 2 of https://www.geeksforgeeks.org/data-structures-and-algorithms-set-7/

Quiz of this Question

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :