Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  A binary search tree is generated by insertin... Start Learning for Free
A binary search tree is generated by inserting the following integers in order:
50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24
How many nodes are there in the left sub-tree and the right sub-tree of the root, respectively?
  • a)
    (4, 7)
  • b)
    (7, 4)
  • c)
    (8, 3)
  • d)
    (3, 8)
Correct answer is option 'B'. Can you explain this answer?
Most Upvoted Answer
A binary search tree is generated by inserting the following integers ...
Binary Tree - Tree in which each node has at most two child nodes.
Binary search tree - A binary tree in which the left child contains only nodes with values less than the parent node, and the right child contains only nodes with values greater than or equal to the parent. Binary search tree is used for efficient searching. The binary search tree for the above problem is given below.
Free Test
Community Answer
A binary search tree is generated by inserting the following integers ...
Explanation:
To find the number of nodes in the left sub-tree and the right sub-tree of the root, we need to construct the binary search tree from the given integers.

Constructing the Binary Search Tree:
1. Start with an empty binary search tree.
2. Insert the integers in the given order: 50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24.

The binary search tree will be constructed as follows:

```
50
/ \
15 62
/ \ / \
5 20 58 91
/ / /
3 37 60
\
24
```

Counting Nodes:
To count the number of nodes in the left sub-tree and the right sub-tree of the root, we can traverse the tree in a depth-first manner and count the nodes.

Counting Nodes in Left Sub-tree:
Starting from the root node (50), we can count the nodes in the left sub-tree as follows:
1. Move to the left child (15).
2. Move to the left child (5).
3. Move to the left child (3).
4. There are no more left children. Move to the right child (8).
5. There are no more left children. Move to the right child (20).
6. There are no more left children. Move back to the previous node (5).
7. There are no more left children. Move back to the previous node (15).
8. There are no more left children. Move back to the previous node (50).

We have counted 4 nodes in the left sub-tree: 3, 5, 8, and 20.

Counting Nodes in Right Sub-tree:
Starting from the root node (50), we can count the nodes in the right sub-tree as follows:
1. Move to the right child (62).
2. Move to the left child (58).
3. There are no more left children. Move back to the previous node (62).
4. Move to the right child (91).
5. There are no more left children. Move back to the previous node (62).
6. There are no more left children. Move back to the previous node (50).

We have counted 7 nodes in the right sub-tree: 58, 60, 91, 37, 24.

Therefore, the number of nodes in the left sub-tree is 4 and the number of nodes in the right sub-tree is 7. Hence, the correct answer is option B: (7, 4).
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

A binary search tree is generated by inserting the following integers in order:50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24How many nodes are there in the left sub-tree and the right sub-tree of the root, respectively?a)(4, 7)b)(7, 4)c)(8, 3)d)(3, 8)Correct answer is option 'B'. Can you explain this answer?
Question Description
A binary search tree is generated by inserting the following integers in order:50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24How many nodes are there in the left sub-tree and the right sub-tree of the root, respectively?a)(4, 7)b)(7, 4)c)(8, 3)d)(3, 8)Correct answer is option 'B'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about A binary search tree is generated by inserting the following integers in order:50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24How many nodes are there in the left sub-tree and the right sub-tree of the root, respectively?a)(4, 7)b)(7, 4)c)(8, 3)d)(3, 8)Correct answer is option 'B'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for A binary search tree is generated by inserting the following integers in order:50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24How many nodes are there in the left sub-tree and the right sub-tree of the root, respectively?a)(4, 7)b)(7, 4)c)(8, 3)d)(3, 8)Correct answer is option 'B'. Can you explain this answer?.
Solutions for A binary search tree is generated by inserting the following integers in order:50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24How many nodes are there in the left sub-tree and the right sub-tree of the root, respectively?a)(4, 7)b)(7, 4)c)(8, 3)d)(3, 8)Correct answer is option 'B'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of A binary search tree is generated by inserting the following integers in order:50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24How many nodes are there in the left sub-tree and the right sub-tree of the root, respectively?a)(4, 7)b)(7, 4)c)(8, 3)d)(3, 8)Correct answer is option 'B'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of A binary search tree is generated by inserting the following integers in order:50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24How many nodes are there in the left sub-tree and the right sub-tree of the root, respectively?a)(4, 7)b)(7, 4)c)(8, 3)d)(3, 8)Correct answer is option 'B'. Can you explain this answer?, a detailed solution for A binary search tree is generated by inserting the following integers in order:50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24How many nodes are there in the left sub-tree and the right sub-tree of the root, respectively?a)(4, 7)b)(7, 4)c)(8, 3)d)(3, 8)Correct answer is option 'B'. Can you explain this answer? has been provided alongside types of A binary search tree is generated by inserting the following integers in order:50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24How many nodes are there in the left sub-tree and the right sub-tree of the root, respectively?a)(4, 7)b)(7, 4)c)(8, 3)d)(3, 8)Correct answer is option 'B'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice A binary search tree is generated by inserting the following integers in order:50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24How many nodes are there in the left sub-tree and the right sub-tree of the root, respectively?a)(4, 7)b)(7, 4)c)(8, 3)d)(3, 8)Correct answer is option 'B'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev