147k views
1 vote
Build a binary search tree for the following list using numerical order: 52,17,64,21,27,65,48,33,55,19 How many leaves are there in the rooted tree you have constructed?

User Metadaddy
by
7.7k points

1 Answer

4 votes

Final answer:

A binary search tree constructed from the given list results in 5 leaves, which are the nodes with no children: 33, 19, 48, 65, and 55.

Step-by-step explanation:

To build a binary search tree (BST) from the given list of numbers, we start by choosing the first number as the root and then insert the subsequent numbers while following the rules of the BST. The number to be inserted is compared with the root; if it's lesser, it goes to the left; if greater, it goes to the right. This process is repeated for each node until the number is placed in the correct position.

The BST constructed from the list 52, 17, 64, 21, 27, 65, 48, 33, 55, 19 will look like this:

  • Root: 52
    • Left Child: 17
      • Right Child: 21
        • Right Child: 27
          • Left Child: 33
      • Left Child: 19
    • Right Child: 48
  • Right Child: 64
    • Right Child: 65
    • Left Child: 55




In this tree:

  • Leaves (nodes with no children): 33, 19, 48, 65, 55

Therefore, the number of leaves in the constructed rooted tree is 5.

User Nicolas Cortot
by
8.6k points