OA. free
Free
Micron Data Structures & Algorithms Data Structures & Algorithms Medium

QUESTION 20 Consider a binary tree T with 50 nodes as: 1, 2, 3, 4, ....., 26, ....., 50 If...

Micron technical mcq question, verified with a worked answer. Free to practise - no sign-up.

QUESTION 20

Consider a binary tree T with 50 nodes as:

1, 2, 3, 4, ....., 26, ....., 50

If the above values are the nodes of an almost complete binary tree where 1 is the root node, 2 is its left child and 3 is its right child so on, then what is the Parent node, Left Child of node 17?

**MCQ

Choose one option.
Show answer & explanation
Answer: A. Parent: 8, Left Child: 34, Right Child: 35

In a complete binary tree with level-order numbering (1 as root), for any node n: parent = floor(n/2), left child = 2n, right child = 2n+1. For node 17: parent = floor(17/2) = 8, left child = 2×17 = 34, right child = 2×17+1 = 35. All three children exist within the 50-node constraint.

Step-by-step Derivation:
Using the standard binary tree indexing formulas for a complete binary tree stored in array form:

  1. Parent of node 17:
    parent = ⌊17/2⌋ = ⌊8.5⌋ = 8 ✓

  2. Left Child of node 17:
    left_child = 2 × 17 = 34 ✓
    (34 ≤ 50, so it exists)

  3. Right Child of node 17:
    right_child = 2 × 17 + 1 = 35 ✓
    (35 ≤ 50, so it exists)

Tree structure visualization (partial):

        1 (root)
       / \
      2   3
     / \ / \
    4  5 6  7
   ...
        8
       / \
     16  17 ← node in question
    /|  /|
  32 33 34 35

Node 17 has parent 8, left child 34, and right child 35.