GATE CS 2000 · Arrays & Matrix Representation

MCQ · 1 mark · Problem PROG-DSTR-0253

Consider the following nested representation of binary trees: (X Y Z) indicates Y and Z are the left and right subtrees, respectively, of node X. Note that Y and Z may be NULL, or further nested. Which of the following represents a valid binary tree?
  1. A
    (1 2 (4 5 6 7))
  2. B
    (1 (2 3 4) 5 6) 7)
  3. C
    (1 (2 3 4) (5 6 7))
  4. D
    (1 (2 3 NULL) (4 5))

Solve it on GATE DA practice →More Basic Data Structures problems

Show the worked solutionOfficial GATE Answer Key: Option C.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/637/gate2000-1-14

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com