Suppose a binary search tree has been constructed from the following sequence of numbers in the order in which they arrive : 6, 2, 10, 1, 5, 7, 11, 3, 9, 4, 8. Consider the following piece of code :

Show(root) { if (root !=NULL)

{ printf(“% d”, root → key);

show (root → right);

show (root → left);

}

else

return ; 

}

The sequence printed will be : 

This question was previously asked in
NIELIT Scientific Assistant CS 5 Dec 2021 Official Paper
View all NIELIT Scientific Assistant Papers >
  1. 6, 11, 10, 7, 8, 9, 2, 4, 3, 5, 1 
  2. 6, 11, 7, 9, 8, 10, 2, 5, 1, 3, 4
  3. 6, 10, 11, 7, 9, 8, 2, 5, 3, 4, 1 
  4. 6, 10, 2, 11, 7, 9, 8, 5, 3, 4, 1

Answer (Detailed Solution Below)

Option 3 : 6, 10, 11, 7, 9, 8, 2, 5, 3, 4, 1 
Free
NIELIT Scientific Assistant Quantitative Aptitude Mock Test
0.9 K Users
20 Questions 20 Marks 30 Mins

Detailed Solution

Download Solution PDF

The correct answer is: Option 3

Key Points

  • We are given a sequence of numbers to build a Binary Search Tree (BST): 6, 2, 10, 1, 5, 7, 11, 3, 9, 4, 8
  • The function Show(root) performs a non-standard traversal:
    • Visit Root
    • Traverse Right Subtree
    • Traverse Left Subtree

Step-by-step construction of BST:

  • Insert 6 → root
  • 2 goes to left of 6
  • 10 to right of 6
  • 1 to left of 2
  • 5 to right of 2
  • 7 to left of 10
  • 11 to right of 10
  • 3 to left of 5
  • 9 to right of 7
  • 4 to right of 3
  • 8 to left of 9

Traversal Output (Root → Right → Left):

6, 10, 11, 7, 9, 8, 2, 5, 3, 4, 1 

Therefore, the correct option is: Option 3.

Latest NIELIT Scientific Assistant Updates

Last updated on Jul 3, 2025

-> NIELIT Scientific Assistant answer key 2025 has been released at the official website. 

-> NIELIT Scientific Assistant admit card 2025 has been released. 

-> NIELIT Scientific Assistant city intimation slip 2025 has been released at the official website.

-> NIELIT Scientific Assistant exam 2025 is scheduled to be conducted on June 28. 

-> A total number of 113 revised vacancies have been announced for the post of Scientific Assistant in Computer Science (CS), Information Technology (IT), and Electronics & Communication (EC) streams.

-> Online application form, last date has been extended up to from 17th April 2025.

->The NIELT has revised the Essential Qualifications for the post of Scientific Assistant. Candidates must possess (M.Sc.)/ (MS)/ (MCA) / (B.E.)/ (B.Tech) in relevant disciplines.

 

-> The NIELIT Scientific Assistant 2025 Notification has been released by the National Institute of Electronics and Information Technology (NIELIT).

More Linked List Questions

Get Free Access Now
Hot Links: teen patti master real cash teen patti master apk download teen patti star apk