00:01
In this video, we'll be drawing a binary search tree step by step by inserting the list of numbers here.
00:08
I've noted vst properties on the upper right hand side of the screen.
00:13
So the left subtree of a node will only contain nodes with keys that are less than the nodes key.
00:20
And then the right subtree of a node will contain only nodes with keys greater than or equal to the nodes key.
00:27
This is greater than or equal to because duplicates.
00:30
Can be handled by allowing same keys on the right side.
00:36
Lastly, the right and left sub -tree must also be binary search trees.
00:41
So i've already created an outline to start our binary search tree.
00:45
The first thing we'll do is insert 11.
00:51
The next number we're going to look at is 6.
00:54
So 6 is less than 11.
00:56
So we'll insert 6 on the left here.
01:12
So next we'll insert 8.
01:15
So we compare 8 to 11.
01:20
8 is less than 11.
01:23
So we head over to 6, and 8 is greater than or equal to 6.
01:29
So we go ahead and put 8 on the right side of 6 here.
01:57
Next, we'll insert 19.
02:00
So 19 is greater than you're equal to 11.
02:04
So we will put 19 on the right hand side of 11.
02:19
Next we'll insert 4.
02:23
4 is less than 11.
02:26
So we head over to 6.
02:28
4 is less than 6.
02:29
So we insert 4 on the left of 6.
02:42
Next we'll insert 10.
02:44
So 10 is less than 11.
02:48
Now we compare it to 6.
02:50
10 is greater than are equal to 6.
02:52
So we compare it to 8...