AVL Tree Explained and Implemented in Java | AVL Trees Rotations | Self-Balancing Trees | Geekific

preview_player
Показать описание

In the previous video of this Trees series, we discussed and implemented binary search trees. These trees provide a fast and easy way to store and retrieve our data. However, during this same video we pinpointed one drawback of BSTs. This implementation’s performance will drastically degrade if the tree we are dealing with is not a balanced tree. Therefore, to tackle this problem AVL trees, which are covered and implemented in this video, came into existence.

Timestamps:
00:00 Introduction
00:36 What are AVL Trees?
01:58 When is a Tree Balanced?
03:22 Tree Rotations Explained
07:04 AVL Tree Implementation
10:46 Implementing and Understanding Rotations
15:33 Thanks for Watching!

If you found this video helpful, check other Geekific uploads:

#Geekific #AVL #SelfBalancingBST #BST #Java
Рекомендации по теме
Комментарии
Автор

I loved this. The code was super easy to follow and the length of the video was perfect. Thank you for this, it helped me a lot with understanding the implementation.

briannadunfield
Автор

Excellent work - thank you for such a clear exposition.

jodnova
Автор

Can't be more helpful, love the code and the explanation!!!!

JasonZhang-bitv
Автор

Loving your videos. Very informative & easy-to-follow!

SatchelHamilton
Автор

awesome man _/\_, skiplist and treaps next ?

amol_
Автор

The code was so clean and detailed with images thnx lot!

omergrn
Автор

You are the best! Thank you so much for this video 😍 I finally understand AVL Trees 🤩

zuzkalysova
Автор

hey man! I love the going over of code and demonstration. However, there's a problem. For an AVL tree, you do the rotations within the insertion method. So the tree strycture of 10, having 6, 4, 9 as left children and unbalanced would not even arise (since you'd be balancing/rotating with every insert). So as soon as with the insertion of the third element (4 or 6 or 10) you would have balanced the tree

rahuldeshpande
Автор

Great video! It helped me a lot to better understand the AVL trees.

hydrixx
Автор

Great content, love the modular code! It'll be great if you can provide a link to the full code.

crystalcuthinho
Автор

11:05 unfortunately you've got the AVL balance in wrong order. It is defined as: b = heightR - heightL; such that if R is higher, b>0 (just like the descending order!) See 11:20
That means your rotation names in the following code are inverted.

Yes you could say "it's definition-dependent" but the common definition seems to be that b>0 is right-heavy, b<0 is left-heavy. Do you have time to make an updated video?

VADemon
Автор

Do u provide the full code of the programs? That would be helpful

rahuzcraftz
Автор

the height of a leaf node is 0 tho, right?

ottttoooo