arrow
arrow
arrow
A binary search tree is obtained by inserting the words **"Mathematics", "Physics", "Geography", "Zoology", "Metrology", "Geology", "Psychology" and "
Question

A binary search tree is obtained by inserting the words **"Mathematics", "Physics", "Geography", "Zoology", "Metrology", "Geology", "Psychology" and "Chemistry"** in order. Words are compared by dictionary order. Arrange the following words in increasing order of their level in the tree.
A. Mathematics
B. Zoology
C. Psychology
D. Physics
Choose the correct answer from the options given below:

A.

A, D, C, B

B.

A, C, D, B

C.

A, D, B, C

D.

C, B, D, A

Correct option is C


A Binary Search Tree (BST) is constructed by inserting the given words one by one, comparing them according to dictionary (lexicographic) order.
1. Constructing the BST
The words are inserted in the following order:
1. Mathematics
2. Physics
3. Geography
4. Zoology
5. Metrology
6. Geology
7. Psychology
8. Chemistry
For a BST:
· If the new element is less than the current node, move to the left.
· If the new element is greater than the current node, move to the right.
Here, comparison is performed using dictionary order.
2. Insert "Mathematics"
The first element inserted becomes the root:
Mathematics
3. Insert "Physics"
Compare:
Physics > Mathematics
Therefore, Physics is placed to the right of Mathematics.

4. Insert "Geography"
Compare Geography with Mathematics:
Geography < Mathematics
Therefore, Geography becomes the left child of Mathematics.

5. Insert "Zoology"
Compare:
Zoology > Mathematics
Move right to Physics.
Now:
Zoology > Physics
Therefore, Zoology becomes the right child of Physics.

6. Insert "Metrology"
Compare with Mathematics:
Metrology > Mathematics
Move to Physics.
Metrology < Physics
Therefore, it becomes the left child of Physics.

7. Insert "Geology"
Compare with Mathematics:
Geology < Mathematics
Move left to Geography.
Now compare:
Geology > Geography
Therefore, Geology becomes the right child of Geography.
8. Insert "Psychology"
Compare:
Psychology > Mathematics
Move right to Physics.
Then:
Psychology < Physics
Move left to Metrology.
Now:
Psychology > Metrology
Therefore, Psychology becomes the right child of Metrology.
9. Insert "Chemistry"
Compare:
Chemistry < Mathematics
Move to Geography.
Then:
Chemistry < Geography
Therefore, Chemistry becomes the left child of Geography.
10. Final BST
The complete BST is:

Now determine the levels:

Level
Word(s)
0
Mathematics
1
Geography, Physics
2
Chemistry, Geology, Metrology, Zoology
3
Psychology
For the four words asked in the question:
Word
Option
Level
Mathematics
A
0
Physics
D
1
Psychology
C
3
Zoology
B
2
Therefore, the increasing order of their levels is:
A, D, B, C

Free Tests

Free
Must Attempt

Basics of Education: Pedagogy, Andragogy, and Hutagogy

languageIcon English
  • pdpQsnIcon10 Questions
  • pdpsheetsIcon20 Marks
  • timerIcon12 Mins
languageIcon English
Free
Must Attempt

UGC NET Paper 1 Mock Test 1

languageIcon English
  • pdpQsnIcon50 Questions
  • pdpsheetsIcon100 Marks
  • timerIcon60 Mins
languageIcon English
Free
Must Attempt

Basics of Education: Pedagogy, Andragogy, and Hutagogy

languageIcon English
  • pdpQsnIcon10 Questions
  • pdpsheetsIcon20 Marks
  • timerIcon12 Mins
languageIcon English

Similar Questions

test-prime-package

Access ‘UGC NET Computer Science’ Mock Tests with

  • 60000+ Mocks and Previous Year Papers
  • Unlimited Re-Attempts
  • Personalised Report Card
  • 500% Refund on Final Selection
  • Largest Community
students-icon
527k+ students have already unlocked exclusive benefits with Test Prime!

Similar Questions

Our Plans
Monthsup-arrow