Computer Science, asked by luckyalapati1513, 7 months ago

develop a binary search tree resulting after inserting integer keys 49,27,12,11,33,77,25,56,23,6

Answers

Answered by AnindaBasu
5

Answer:

The required binary search tree will be based on the root value If the key is less than root value it will be left child and if it is more than root value it will be the right child

Attachments:
Answered by anjalin
0

Please find the attached image of the Binary Search tree created inserting the values: 49, 27, 12, 11, 33, 77, 25, 56, 23, 6

Explanation:

  • Firstly the tree is empty, so 49 is inserted as the root of the tree.
  • Since 27<49, 27 is inserted at the left of 49.
  • Since 12<49, it is moving further and compared with the root node of the left subtree.
  • Since 12<27, it is placed in the left of 27.
  • Similarly, since 11<12, it is placed in the left of 12.
  • since 33>27, it is placed on the right of 27.
  • since 77>49, it is placed on the right of 49.
  • since 25>12, it is placed on the right of 12.
  • since 56<77, it is placed in the left of 77.
  • since 23<25, it is placed in the left of 25.
  • since 6<11, it is placed in the left of 11.

Thus, the Binary Search Tree constructed after following these steps is attached in the form of an image.

Attachments:
Similar questions