• Register
110 points

Overview  Binary search Tree

Today we will see in our website kodlogs how to create a binary search tree in Python. This tree means to write the Python program with the help of a tree. Today Tania will show you what its purpose is.  There are children. You need to know the root and then you can go anywhere. The simplest way is to have a value. It will have a left and a right arrow which we call left sub tree and right sub tree.  I was learning programming. So I was having a hard time creating a program. Then my teacher asked me to make a binary search tree. I was given some numbers. I was taught how to make a search tree. I had a lot of fun.  At the institute, she came first in her class and began to explain to other students as well.  That was the best day of my life. And today I will satisfy you in kodlogs because after learning in difficult situations when we give that knowledge to others. The heart gets a lot of relief.  

7,6,10,12,14,5,4,8,13 We always start with the node root  which is 7. In this tree there should be a large value in the right of the root and a low value in the left.  The whole algorithm works on this. We also call the binary search tree (BST). Let's see an example of how we create a binary search tree to understand the Python program.

Example 1

       Kodlogs binary search Tree

                         Root node
                           /       \
                       ( d)       (o)
                    /                \
                  (L)               (o)
              /                        \
           (g)                       (s)
   Left sub tree        Right sub tree 

Example 2

       6   10
       /       \
      5        12
      /          \
     4            13


110 points