In this hands-on AVL tree tutorial, we take a massive unbalanced linear binary search tree and perform multiple rotations to turn it into a properly balanced AVL tree. Watch as we identify imbalance, label X Y Z nodes, determine A B C, handle outstanding children, and reattach subtrees step by step.
Perfect for computer science students learning data structures, self-balancing trees, and AVL rotations. We go through several rotations on the same tree to show the full process from start to finish.
If you’ve seen the basics, this is the practice video you’ve been looking for. Timestamps and clear diagrams included.
Like and subscribe for more data structures content!
00:00 Introduction to AVL Rotations Practice
00:22 Previous Videos Overview
00:56 Understanding the Linear Tree Problem
01:24 Why Balance This Tree
02:20 Computing Balance Factors
03:16 First Rotation Setup XYZ
04:04 In-Order ABC Pattern
05:50 Reattaching Subtree
07:17 Recompute Balance Factors
08:06 Second Rotation Setup
09:20 XYZ and ABC for Second Rotation
10:08 Drawing Output Pattern
11:40 Placing Outstanding Children
13:32 Third Rotation Setup
14:28 XYZ for Third Rotation
15:02 Output Pattern and Children
18:28 Recompute Balance Factors
19:28 Fourth Rotation Setup
20:04 XYZ for Final Rotation
20:32 Handling All Outstanding Children
23:20 Reattaching Final Subtree
24:50 Last Rotation Setup
25:48 XYZ and ABC Final
26:38 Output Pattern and Children Placement
30:16 Final Balance Factors Check
30:52 Valid AVL Tree Achieved
31:07 Conclusion and Thanks
=-=-=-=-=-=-=-=-=
Thanks for watching!
Find us on other social media here:
- https://www.NeuralLantern.com/social
- Twitter / X: https://x.com/NeuralLantern
- Rumble: https://rumble.com/c/c-3696939
- BitChute: https://www.bitchute.com/channel/pg1Pvv5dN4Gt
- Daily Motion: https://www.dailymotion.com/neurallantern
- Minds: https://www.minds.com/neurallantern/
- Odysee: https://odysee.com/@NeuralLantern:5
Please show your support!
- Buy me a coffee: https://ko-fi.com/neurallantern
- Subscribe + Sharing on Social Media
- Leave a comment or suggestion
- Subscribe to the Blog: https://www.NeuralLantern.com
- Watch the main “pinned” video of this channel for offers and extras
Hello there! Let’s practice AVL rotations with a big ugly gross linear tree that for some reason hasn’t been rotating up to this point.
But we’re going to rotate it all at once to make it nice and balanced per the rules of AVL trees, just for practice.
Okay, so first off, you should have hopefully seen my previous videos.
search trees how to define them how to build them search through them add remove stuff all that
stuff and then we talked about abl trees which are really just self-balancing binary search
trees with some extra special rules on top we talked about the types of rotations how to do
the rotations when to rotate when to how to detect whether a tree is actually a valid abl tree and
all that stuff so if you don’t know what i’m talking about see my previous videos otherwise
we’re just going to practice on this one tree right now we’re just going to do a practice run
run. Okay so you would never I mean you would hopefully never see an AVL tree
that looks like this. This is way too imbalanced for an AVL tree. An AVL tree
would have started rebalancing itself a long time ago but let’s just pretend for
the sake of argument that you disabled the balancing feature of your AVL tree.
You maybe like have a boolean inside of your class that you’ve written in your
program called am I behaving like an AVL tree true or false and you set it to
for a while then you started throwing nodes at the tree after you ended up with this giant linear
tree then we’re going to suddenly turn on the avlness bool and start rotating this tree sucks
this is a valid binary search tree but like if you notice it follows all the rules of a binary
search tree and the data is in order but this is definitely not a valid avl tree the time
complexity of searching through this tree would be o of h and since o of h is actually the number
h is actually the number of nodes in the entire tree the time complexity of
searching through this particular tree is o of n so this is a linear tree it’s
no faster to search through than a linked list at least in terms of
scalability so this is bad we need to fix this so now let’s turn on the AVL
ness we’ll say okay now you’re no longer pretending to be a regular binary search
tree you’re an AVL tree let’s do some rotations the first thing we should do
do if you’re presented with a tree like this all at once is just compute the balance factors for
every single node. So I’m going to say the 55 is a leaf it has a balance factor of 0, the 42 has a
balance factor of 1, and really the balance factors just increase by 1 for every level up we go. So
the balance factor of the 15 node is horrible, it’s really really really bad. Now that we’ve done
this we could rotate anywhere we wanted to. I mean it’s valid to rotate starting with the 34 or the
or the 27 or 22 or 15 you wouldn’t want to rotate the 42 because that’s not
imbalanced enough for an AVL tree but really the smartest thing to do is
rotate as low as possible because when you rotate stuff that’s lower it tends
to fix stuff that’s higher so then you’ll end up doing less work and
probably end up with a tree that matches what someone else expected okay so we’re
going to rotate as low as possible that means I’m going to find the lowest node
and I’m going to say it’s the 34 node and I’ll label that as Z.
That’s bad. Let me try again.
34 is Z.
Okay, then we find the A child of the Z node
and we have to find the child that has a taller subtree,
but there’s only one choice.
We can only go to the right.
There’s nothing on the left.
So that means Y is the 42 node.
Same thing for the X node.
We’re labeling for X and we have to find a child of Y.
We have to look at the taller subtree,
We have to look at the taller subtree, but there is no other choice.
We can only go down and to the right.
So now we know our XYZ.
I’m just going to place these labels up here at the top.
I’m going to say X is 55, Y is 42, and Z is 34.
And maybe I’m going to change that text color real fast.
Then we want to produce an in-order representation of XYZ.
This step, I think it helps people with diagrams, but it also helps you a lot when it comes time to code.
when it comes time to code,
because coding for these rotations is way easier
than diagramming these rotations.
You pretty much just have to come up with three new pointers,
A and B and C,
and all they are is the ordered version of XYZ.
So, you know, which node belongs on the very left,
that’s gonna be 34,
which node would belong in the middle,
that’s gonna be 42,
which node would belong on the right side,
that’s gonna be 55.
And so now we’re ready to come up with our output pattern.
So I’m just gonna take one of these nodes
So I’m just going to take one of these nodes and copy it.
Maybe get rid of that little stem there.
And then I’m going to just, you know, copy paste this a couple of times as quickly as I can.
It doesn’t need to be perfect.
But if it’s not, they’ll laugh at you.
Okay.
So we’ll do this.
And we’ll draw some connecting lines.
So we’ve got like three nodes here.
A perfect little tri-node subtree because we picked X and Y and Z.
because we picked X and Y and Z and that became A and B and C.
Can’t get that line right, I’m going to give up.
So then we, I’m going to fix the labels here. So what is A belonging on the left?
That’s 34. What is B which belongs in the middle? That’s 42.
What is C which belongs on the right? That’s 55. So now we have
a perfectly balanced trinode subtree. Notice how this is a valid binary search tree.
If the numbers were in a different order, this wouldn’t be
a valid binary search tree and you’d have to try again with your ordering and also this has to be
a perfectly balanced trinode subtree otherwise this probably wouldn’t actually help if we if
we did a different output pattern it wouldn’t help the tree so then the next thing we need to do is
just double check that we don’t have any nodes that are unaccounted for from the input pattern
the xyz nodes so if we look at the uh the 34 node let’s look at z first i guess we’ll look at the 34
had 42 as a child but 42 is already handled so that’s actually okay then we look at the y node
that’s 42 it had 34 and 55 as children the 34 was handled uh here and the 55 is handled here so we
actually are fine we don’t need to worry about that now we’ll look at the x node the x node had
no children so we’re pretty much done again like i said in previous videos there could have been up
You know, each of these XYZ nodes could have had its own children.
Notice how 34 could have had one, 42 could have had one, 55 could have had two.
So there would be four outstanding children.
So we’re actually done at this point with the outstanding children.
There are none.
So I’m ready to reattach this tree, I guess the rotated subtree, into the regular tree.
So these three nodes can just go away from our diagram.
In code, you’re not actually removing these nodes.
You’re just sort of, you know, reattaching pointers.
reattaching pointers but I’m going to redraw this in a way that looks kind of nice and I’ll just
maybe redo this line real fast so I’m going to do a blue line here okay now we have to recompute the
balance factors so I’m going to say that the 34 is a leaf it’s got balance factor of zero same for
perfectly balanced and then we have to work our way up until we reach the root node. So
the 27 node, it’s got two nodes hanging off the right side and nothing on the left.
So its new balance factor is two. So it actually improved a little bit.
The 22 node, one, two, three, it’s got three nodes hanging off the right side and nothing
on the left. So it improved a little bit to three. And I’m guessing that the 15 also improved to four.
You can see the height on the left subtree of 15 is one, two, three, four, nothing on the left,
So we’re done with this particular rotation.
But because we see a node that has a balance factor of two or worse,
we’re not actually done rotating.
This is still an invalid AVL tree.
And under the hood, we would continually just, you know, rotate up and up and up the tree
until everything looked like it was fixed.
So again, the first node that’s out of whack, or I guess the lowest node that’s out of whack,
we’ll call that our Z node.
So we’re going to put a Z here.
piece of text and then we have to find a child of Z with the tallest subtree so there’s no child on
the left which means we have to go to the right to find our Y node okay then we have to go find X
through a child of Y and we have to find the child with the taller subtree actually the left child
and the right child have the same height of their trees of their subtrees so it doesn’t actually
know for fun let’s just go to the left because it’ll probably be harder we’ll say that the x
node is 34. be consistent if you always whenever you see like sub trees that are equal height
i don’t know maybe try to be consistent going left or right but in this case it doesn’t really matter
so we have xyz i’m going to type them up again right here we’re going to say x equals
Let me just double check that 34 42 27 and then we’ll produce ABC, which are the in order
representations of XYZ.
Again, imagine you’re using pointers if you’re doing this in code.
So we have like a is equal to the least value, the one that would belong on the left.
That’s the 27 B should be 34 and C should be 42.
And then, you know, just visually check.
way so that all the nodes have their own space. The one that’s furthest on the left is Z and that
ends up being A. The one in the middle is X, that’s B, and the one on the right is C, that’s 42, Y.
Right, yeah. Okay, so now that we’ve selected our ABC we can start drawing the output pattern. So
I’m going to like make a little copy of this and I’m just going to very quickly try to draw
balanced maybe a little bit lower they’ll laugh at you um they won’t they will i’m just kidding
let me finish this line
all right fix the numbers real fast uh so a is supposed to be on the left so that’s 27 that’s
already good uh b is 34 c is 42 so now we have to just worry about the unaccounted for children of
unaccounted for children of ABC or XYZ. So first I’m going to look at X. Whoops.
We look at X, it’s 34. It had no children of its own, so we don’t even have to worry about any of
its children. So we’re done. We look at Y, Y had two children. It had 34, but 34 was already handled
up here. And it had a right child of 55. Oh, so we have a child that is unaccounted for now. So I’m
duplicate it over here. We got to put it somewhere. I don’t know where just yet.
You can probably figure it out, but I’m just going to put it over there. Now we’re done looking for the Y.
And then next we’ll look at the Z node.
So I’m going to do
the Z node is 27. It had a 42 as a right child, but 42 was already handled in the output pattern.
So we’re done looking for outstanding children.
So the next thing I’m going to do is figure out where the heck does that 55 go?
does that 55 go? Remember, we’re trying to make valid binary search trees, which means there’s
only one place where this 55 node could actually go. If you stuck it on the left side, a greater
value on the left of 27, that’s invalid. That wouldn’t work. 55 is greater than 34, so it can’t
go on the left. It’s greater than 42. So actually 55 belongs all the way on the right side, because
again, that’s the only place it would actually work to allow us to still have a valid binary
search tree when we were done placing it so double check the subtree that you have written down after
you’re done doing all this stuff and make sure that the whole entire tree is a valid binary search
tree if not you probably have to try again okay so i’m going to duplicate this slide right here
and we’re going to say that we’ve got four nodes ready to be inserted in place of these four nodes
over here one two three four so i’m going to just select all four of these nodes and just delete them
and reinsert the rotated, you know, the rotated nodes, which are the same nodes, but they’re just,
you know, they’re drawn differently with, you know, different connections. And then I’m going
to fix this connection over here. So that’s 34 is now the right child of 22. Then I have to do
the balance factors for all of the nodes that we rearranged. So the leaves are easy. As usual,
This 42 has a balance factor of 1, and this 34 has a balance factor of also 1.
It’s not perfect, but it’s okay.
Then we work our way up the tree until we find the root node.
So now we’re going to recompute the balance factor for the 22.
Actually, it doesn’t improve.
If you notice, the right subtree has a height of 1, 2, 3.
There is no left subtree, so the balance factor is 3.
Same thing for this 15 node.
So we made a little progress.
Not much.
We have to keep going.
So, you know, once again, I’m going to select the lowest node that’s out of whack.
Or I guess as I work my way up the subtree, I can see that three node is still out of whack.
So I’m going to call that Z.
Nope.
Somebody remind me to do what types of rotations to talk about the rotation types.
Somebody send me an email or a comment.
I’m going to do it at the end of this video, but send me a comment anyway.
So the Z node is the 22 node.
22 node to find the y node we have to take a child of z with the tallest subtree but that’s obviously going to be 34
There’s no other choice
And now we actually do have an interesting choice to find the x node
It has to be a child of y, but it’s got to be the child with the tallest subtree
So for the first time we can kind of see
That we you know, we might have wanted to put x on the left or right, but it has to be on the right
We’re not allowed to put it on on the left at least for this method
So there we go. We have our XYZ. I’m going to go ahead and do X is equal to 42, and Y is equal to 34, and Z is equal to 22, and then A, B, and C are going to be the in-order representations.
the middle 42 goes on the right so now i’m ready to draw my output pattern so i’m going to like
select this real fast duplicate it up here make some copies making copies anyone no okay just
just wondering okay i’m going to do this do some connecting lines
So A is supposed to be on the left, that’s 22, and then B is going to be 34, and C is
going to be on the right, that’s going to be 42.
So we have a perfectly balanced trinode subtree.
Now we’ve got to double check for outstanding children.
So we start by looking at the Z node.
Oh my god.
Not as skilled as I think I am.
We look at the Z node.
which is already handled over here so we’re fine that way then we’ll look at the y node the y node
was 34 it had a left child of 27 that is not accounted for in the output pattern so i’m going
to grab it and then also you know when you’re grabbing these unaccounted for children double
check that they might also have children of their own if they do we have to take them with the node
that we’re moving so if 27 had any children we would not be you know removing or rearranging
children and just kind of you know let them stay in their position underneath 27. You know we would
not rearrange pointers that are further down but in this case what have I done in this case 27
doesn’t have any children I’ll have to do a copy that’s why make a copy put it somewhere so now
we’re done with the 27 on the right side of 34 it had a child of 42 but that’s already handled
42 and then I’ll just put like an arrow here. Now we’re ready to look at the X nodes children.
So the X is 42. It had a right child of 55 which is also not accounted for in the output pattern.
So I’m going to just move that over here.
Okay now we have to place these children in their appropriate positions.
So the 55 if you think about it there’s only one position that the 55 could ever go
go to produce a valid binary search tree so it can’t go there it’s got to go all the way on the
right side so that’s where we’ll put it same thing for the 27 there’s only one place it could go it
can’t go here because it’s less than 34 so it can’t be on the right side of 34 it’s going to
be on the left side of 34 and if you look at where is it going to go with respect to 22 it can’t go
on the left it has to go on the right because again we need a valid binary search tree
So I’m just going to connect this line right here.
And now we’re done making our little output tree, subtree.
So how many nodes did we have in the input tree?
It was 22, 34, 42, and 55, so like five nodes.
And if you look at the output pattern here, there’s also five nodes.
So we’re pretty much ready to just kind of remove all of these nodes
all the way up to that 15.
and make it the right child of 15. So I’m going to select all of this stuff, make it the right child
of 15, and then I guess I’ll just redo that line real fast. So this is a nicely formatted diagram.
So we’ll do what’s going on with my computer. Okay, sometimes it lags. I’m gonna, well,
balance factors now so I’m going to do balance factors for the leaves pretty easy the 22 and the
42 have a balance factor of one again if this is confusing see my previous videos we practiced a
lot of that the balance factor for the 34 is going to be a zero remember it’s about the height of the
left subtree versus the right subtree which there’s no difference actually they both have a height of
two it’s you know just just because there’s a little diagonal bounce there on one side doesn’t
awesome. Not perfect, but it’s pretty good. We look at the 15. What’s the new balance factor of
the 15? It’s actually three now because the height of its right subtree is three and the height of
its left subtree is zero. So its balance factor improved to three. So we are making, you know,
a little bit of progress. Now we know that the only node that’s out of whack in the whole tree
is the 15. So we’re just going to call that our Z node for another rotation. So I’m going to put Z
of z which would be y and there’s no other choice and then once again we have to find a child of y
to find x and we have to take the child that has the taller subtree but both of these subtrees
are equal so i’m just going to go to the right for fun i don’t know i’m going to do x over here
on the on the right side well hang on have i been doing this the easy way oh yeah let’s let’s go to
Okay, so now we have XYZ. I don’t know why I say these things. We’ll do XYZ. X equals 22. Y is equal to 34. I say them for fun. Z is equal to 15. And then we’re going to do A and B and C. So A is going to be the least value. So that’s 15. B is going to be 22. C is going to be 34.
tree so i’m going to copy this over here a couple more times this tree is probably going to be huge
i’m probably gonna have to rearrange this a few times just do this over here make another copy
over here there’s a lot of nodes that are going to be unaccounted for here um i think this was
the example where we ended up just replacing the entire tree let’s see all right i guess that’s
And then I’m going to update the numbers. So A is 15, and B is 22, and C is 34.
So now one by one we have to look for any outstanding children of the nodes in the output pattern.
So we look at, let’s say, the Z first.
The Z had a right child of 34, but that’s already taken care of in the output pattern, so we don’t have to do anything.
now we look at the y the y had a left child of 22 but that’s already taken care of in the output
pattern so we don’t have to worry about that it also had a right child of 42
um so we don’t have to worry about that sorry we do have to worry about that so i’m going to copy
the 42 over here and we’re going to have to do something with it eventually now we’re ready to
If we’re looking at the X node, X node is 22.
It had a right child of 27 that is not in the output pattern.
So that’s something that’s unaccounted for.
I’m going to place it over here.
Okay, now we’re ready to attach the nodes in the output pattern.
Let me just bring something to your attention real fast.
Notice how the 42 node, which was an outstanding child of one of the output pattern nodes,
it had a child of its own, right?
on the bottom here, you know, below the output pattern, if they had any children of their
own, we would not like change their topology. We would not assign them to different parents.
They would just stay exactly where they are, which means just for the purposes of this diagram,
I should probably also bring the 55 down as the right child of the 42. So I can remember,
you know, that it was there and not totally forget it and ruin the tree.
27 had no children, so it’s fine. The 27 should be a left child of 34 because it’s greater than
of 34 because it’s greater than 22 and it’s less than 34 so I’m going to stick it right there and
then where would the 42 go well it would it would be a right child of 34 because it’s greater than
34 so maybe I should make the 27 like just a little bit more to the left okay then I’m going
to reconnect so the 34’s left child is 27 its right child is 42 and then you know this is easy
like I make mistakes all the time too so I just want to double check that this is a valid binary
search tree because I could have you know done the numbers incorrectly so we have 15 22 27 34 42 55
it all increases it is a binary tree so it’s also a binary search tree and then it’s like
it satisfies all the other properties so now how many nodes did I actually remove four five six and
there were only six nodes in the entire tree before we did this rotation you know z is kind of the
know z is kind of the culprit of why this happened so that means the rotated pattern is actually the
final binary search tree so i’m just going to erase the whole entire tree and put the rotated
pattern in the middle here then we just have to recompute all the balance factors to make sure
that we’re done or that we’re not done so the leaves get zero and then the 42 gets a one and
then the 34 gets a one because it’s got a height of one on its left subtree and a height of two on
and a height of 2 on its right subtree, take the absolute value.
The 22 node, I don’t think that’s quite finished yet.
It’s got a balance factor of 2 because it’s here.
Let’s just clarify to make sure everybody’s on the same page.
Anytime I feel that I had to think even a little bit,
I’ll sometimes just kind of take a little step back and make sure everybody’s okay.
So the left subtree has a height of 1.
You can see that I highlighted the left subtree.
The right subtree has a height of 1, 2, 3.
So 1 minus 3, take the absolute value.
That’s going to be 2.
value that’s going to be two so the balance factor of the 22 node is two meaning we’re not done
rotating our tree it could be a little bit better a little bit faster so maybe i’m going to move this
whole thing over to the left a little bit and then we’ll call the 22 node the z node because it’s the
first node that’s out of whack then we have some more interesting choices right remember before
if we’re going to go down into the left or down into the right it always seemed obvious but now
seemed obvious but now to find our y we could go left or right but we have to go to the right
because 34 has the taller subtree 15 it’s it’s a tree of just one it’s a height of one and 34 it’s
a tree of height three so we go to the right to find y to find x again we need to look at a child
of y with the tallest subtree so that’s not going to be 27 that’s a height of one it’s going to be
42 with the height of two so the x node is this over here and now we’re ready to talk about
ready to talk about what is XYZ and ABC. So X is, I always forget to change the color before I type
this. Okay. X is 42. Y is 34. Z is 22. And then we get A and B and C. Okay, so A is the least value,
the one that would belong on the left. I mean, you can just look visually on the diagram again.
on the left right so that would have to be a because anything that starts leftmost should end
up left leftmost in terms of a well-drawn diagram so b is going to be in the middle that’s the 34
and then c is going to be the greatest value which is 42 again c 42 is the rightmost value both
before and after we decided what is a xyz and abc so we’ve got that i’m going to go ahead and start
for another new diagram.
We’re going to say,
we got that.
Give it a little copy.
Give it another little copy.
Give it a copy.
Then I’m going to draw my connections.
Dang, how long is this video?
Man, I knew this was going to be a gnarly example.
That’s why I like doing it.
Okay.
Fix the numbers real fast.
So the 27 is A, it’s 22.
And then this is going to be B, which is 34.
And then 27, or the rightmost node, is going to be the 42.
Then we start looking at children that might be unaccounted for in our target pattern.
So I’m going to duplicate this.
And we’ll say, start by looking at Z.
It had a left child of 15, which is unaccounted for in the output pattern.
So I’m going to move 15 over here somewhere.
And then we look at the 34.
That’s already accounted for in the output pattern.
So we’re done looking at Z’s children.
So I’m just going to do this.
Now we’re ready to look at Y.
Y had a left child of 27.
That’s actually unaccounted for.
So I’m going to move the 20.
I’m going to copy the 27 over here.
And then we look at the 42.
The 42 is already handled in the output pattern.
So we don’t have to worry about it.
worry about it okay now we’re ready to look at the x nodes children so we look at x it had a right
child of 55 that’s also that’s also not accounted for in the output pattern so i’m going to make a
copy so we have like three nodes to worry about and then you know just for diagram purposes in
the code this would be easy to do but for the diagram we have to make sure are we dragging any
of these unaccounted for children away from their other children that they might have so 55 it has
children 27 it has no children 15 also has no children so these are pretty easy so just visually
I’m going to rearrange I lost my camera what happened test test test whoa I’m tripping so I
had a technical issue with my camera I had to edit out I guess a little portion where I was super
confused and screaming and now I think we’re okay so we can continue the video so we’ve just looked
children that are unaccounted for and accounted for them that’s so nice of us
and we’re going to have to place them somewhere so this 15 again it can’t go
anywhere over here on the right side that would be an invalid binary search
tree it’s actually got to go on the left of the 22
it’s the only place it could possibly go same thing for the 55 where is that
going to go I don’t know maybe like all the way to the right because that’s the
only numerically valid you know place that it could go to have a valid binary
27 can’t go on the right of 34 it’s too small it ends up going on the right of 22.
So now we’ve placed the children to account for them and I’m going to just like draw my
connecting lines real fast and then how many nodes do we have here let’s see the 22
1 2 3 4 5 6 1 2 3 4 5 6 oh actually that’s every single node in the tree just like last time we
again guess that that would have happened because it might be likely to happen because the z node
here was actually the root node of the tree. So I’m just going to you know replace the entire tree
and say that we’re done rotating now. So we’ll just do this put this in the middle and then
recompute all the balance factors just to check to see if we’re done. You can probably tell already
this is a pretty decent tree so we might not have to rotate but I’m going to go ahead and
have to rotate but I’m going to go ahead and just double check anyway. So the leaves get zeros
and the 22 gets a zero because it’s got left and right subtrees of equal height. The 42 has a one
and the 34 also has a zero because it’s left and right subtrees are equal height. This is maybe
another good opportunity for me to point out that it’s not about weight or mass on the left versus
right subtrees. It’s just about height only. So even though there are less nodes in the right
The fact remains that the heights are the same. So actually that’s a zero for the root node
This is now finally a valid AVL tree. We have rotated it enough. It is now considered
Log time again, it’s going to be fast to search and insert and remove and all that stuff. So this is pretty great
We are now officially done with this example tree. So thank you so much for watching this video
I hope you learned a little bit of fun and had a little bit of stuff
and I hope you enjoyed doing this tree with me it’s always a little stressful because it’s like
a half hour tree and I always wonder like did I make a mistake five hours ago I don’t even know
so I guess I’ll see you in the next video thanks for hanging in there with me
hey everybody thanks for watching this video again from the bottom of my heart I really
appreciate it I do hope you did learn something and have some fun if you could do me a please
Could you please subscribe and follow this channel or these videos or whatever it is you do on the current social media?
It’s a website that you’re looking at right now
It would really mean the world to me and it’ll help make more videos and grow this community
So we’ll be able to do more videos longer videos better videos or just I’ll be able to keep making videos in general
So please do do me a kindness and and subscribe
You know sometimes I’m sleeping in the middle of the night and I just wake up because I know somebody subscribed or followed
subscribed or followed. It just wakes me up and I get filled with joy. That’s exactly what happens
every single time. So you could do it as a nice favor to me or you could you could troll me if
you want to just wake me up in the middle of the night. Just subscribe and then I’ll just wake up.
I promise that’s what will happen. Also if you look at the middle of the screen right now you
should see a QR code which you can scan in order to go to the website which I think is also named
somewhere at the bottom of this video and it’ll take you to my main website where you can just
all the videos I published and the services and tutorials and things that I offer and all that
good stuff. And, uh, if you have a suggestion for, uh, uh, clarifications or errata or just future
videos that you want to see, please leave a comment. Or if you just want to say, Hey, what’s
up, what’s going on? You know, just send me a comment, whatever. I also wake up for those in
the middle of the night. I get, I wake up in a cold sweat and I’m like, it would really,
really appreciate it. So again, thank you so much for watching this video and enjoy the cool music
as I fade into the darkness, which is coming for us all.
Thank you.
so
Hey there! Let’s rotate an AVL tree…
Hmm…
Test test test! Whoa, I’m trippin’!
