Computer Science, asked by dinukrish98, 11 hours ago

Create a binary search tree for the following numbers start from an empty binary search tree. 45,26,10,60,70,30,40 Delete keys 10,60 and 45 one after the other and show the trees at each stage.

Answers

Answered by chauhankamla344
6

Explanation:

binary is the simplest 7 to be used for ordinateaur and the smallest four digit

Answered by sadiaanam
3

Answer:

the binary search tree is :

        45

      / \

     26  60

    / \   \

   10  30  70

         /

        40

Explanation:

Here is how you can create a binary search tree for the numbers [45,26,10,60,70,30,40]:

Insert 45 as the root:

       45

Insert 26 as left child of 45:

          45

      /

     26

Insert 10 as left child of 26:

       45

      /

     26

    /

   10

Insert 60 as right child of 45:

       45

      / \

     26  60

    /

   10

Insert 70 as right child of 60:

       45

      / \

     26  60

    /    \

   10    70

Insert 30 as left child of 26:

       45

      / \

     26  60

    / \   \

   10  30  70

Insert 40 as right child of 30:

       45

      / \

     26  60

    / \   \

   10  30  70

         /

        40

Now we will delete keys 10,60 and 45 one after the other:

Deleting key 10:

       45

      / \

     26  60

        \   \

        30  70

         /

        40

Deleting key 60:

       45

      /

     26

        \  

        30

         /

        40

Deleting key 45:

      26

        \  

        30

         /

        40

Note that, Deleting operation has different strategies like inorder, post-order and pre-order traversal. The above tree is an example of inorder traversal.

for more visit - https://brainly.in/question/10268226

#SPJ3

Similar questions