GateAI
Binary Search Trees

GATE CSE 2026 Set 1 · Q62

NAT2 marksEasy

Time

The following sequence corresponds to the preorder traversal of a binary search tree TT: 50,25,13,40,30,47,75,60,70,80,7750, 25, 13, 40, 30, 47, 75, 60, 70, 80, 77 The position of the element 60 in the postorder traversal of TT is ________. (answer in integer)

Note: The position begins with 1.

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 7

Binary Search Trees

Given the preorder traversal of a Binary Search Tree (BST):

[50,25,13,40,30,47,75,60,70,80,77][50, 25, 13, 40, 30, 47, 75, 60, 70, 80, 77]
  1. Reconstruct the BST:

    • Root: 5050

    • Left subtree of 50 (elements <50< 50): [25,13,40,30,47][25, 13, 40, 30, 47]

      • Root is 2525.

      • Left of 2525 (<25< 25): 1313

      • Right of 2525 (>25> 25): [40,30,47][40, 30, 47]

        • Root is 4040, left child is 3030, right child is 4747.

    • Right subtree of 50 (elements >50> 50): [75,60,70,80,77][75, 60, 70, 80, 77]

      • Root is 7575.

      • Left of 7575 (<75< 75): [60,70][60, 70]

        • Root is 6060, right child is 7070.

      • Right of 7575 (>75> 75): [80,77][80, 77]

        • Root is 8080, left child is 7777.

  2. Find the Postorder Traversal (Left, Right, Root):

    • Postorder of left subtree of 5050:

      • Left of 2525: 1313

      • Right of 2525: 30,47,4030, 47, 40

      • Root: 2525

      • Sequence: 13,30,47,40,2513, 30, 47, 40, 25

    • Postorder of right subtree of 5050:

      • Left of 7575: 70,6070, 60

      • Right of 7575: 77,8077, 80

      • Root: 7575

      • Sequence: 70,60,77,80,7570, 60, 77, 80, 75

    • Root: 5050

  3. Full Postorder Traversal: 12345678910111330474025706077807550\begin{array}{ccccccccccc} 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \\ 13 & 30 & 47 & 40 & 25 & 70 & 60 & 77 & 80 & 75 & 50 \end{array}

Element 6060 is at position 7 (1-indexed).

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Binary Search Trees previous year question is Q62 of the GATE CSE 2026 Set 1 paper. Find more GATE CSE PYQs on Binary Search Trees in Programming and Data Structures, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Binary Search Trees PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Binary Search Trees in GATE CSE

Binary Search Trees has 21 GATE CSE PYQs across 17 papers from 2011 to 2026. 3 of them are 2-mark NAT questions like this one, and GATE CSE 2026 Set 1 has 2.

How GATE tests Binary Search Trees

More from GATE CSE 2026 Set 1

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2026 Set 1 · Q62 · NAT

The following sequence corresponds to the preorder traversal of a binary search tree T: 50, 25, 13, 40, 30, 47, 75, 60, 70, 80, 77 The position of the element 60 in the postorder traversal of T is … (answer in integer) Note: The position begins with 1.

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.