AVL Tree 6 Rebalancing AVL trees

  Рет қаралды 21,193

RobEdwards

RobEdwards

Күн бұрын

Пікірлер: 16
@potatopassingby
@potatopassingby 4 жыл бұрын
for anyone watching this in the future: dont forget to let the node's parent know that now THIS node on the top is it's left or right child, not the one it was previously pointing to. i dont know how the implementation shown here can work, but i was debugging this whole day to figure that out. (C++) other than that, those videos have been great and really helped me a lot, so a big thanks to you Rob Edwards. Great lessons!
@moody54324
@moody54324 4 жыл бұрын
Hey i did not get that, where should i change my code to work? In rebalance ? Or rotateLeft?.
@Enlightenchannel
@Enlightenchannel 2 жыл бұрын
Hey, nice to know someone else spent a whole day debugging this too. Two years ago. I was looking at the comments on the rotations video instead of here. This would've saved me ALOT OF TIME If I'd seen it.
@rahulbawa6732
@rahulbawa6732 4 жыл бұрын
The parent is not being assigned in the rotate left/right functions.
@codybontecou
@codybontecou 7 жыл бұрын
Wish he went over the height() function he uses. Unsure of how he's keeping track.
@lukaskun6431
@lukaskun6431 7 жыл бұрын
My implementation for my AVL Tree in C#. Not sure, if it is conceptually same as the one in this lecture, but you can take this at least like an inspiration: private int Height(Node node) { if (node == null) return 0; int left = 0; int right = 0; if (node.Left != null) left = Height(node.Left) + 1; if (node.Right != null) right = Height(node.Right) + 1; return right >= left ? right : left; }
@leonazraev4902
@leonazraev4902 6 жыл бұрын
the return doesnt need to be right + left ?
@sonamSelects
@sonamSelects 6 жыл бұрын
Leon Azraev no the height is the length of the longest path to a leaf node.
@felipegodias
@felipegodias 6 жыл бұрын
kzbin.info/www/bejne/fIC3mIOQjr53r7M
@ayushkashyap8299
@ayushkashyap8299 4 жыл бұрын
int height(node* t) { if(t==null) return -1; else return 1 + max(height(t->left), height(t->right)); } Note: Height of a single node is 0 in the above code if you wan't height of single node to be 1 the replace -1 with 0
@Aggabummbumm
@Aggabummbumm 7 жыл бұрын
Can this also be used for deletion?
@x_zero994
@x_zero994 3 жыл бұрын
I wrote the code, but the root didn't change!! and after applying the rotations it didn't print the hole tree when I tried to, Does anyone knows why?
@logiconabstractions6596
@logiconabstractions6596 7 жыл бұрын
Am I tripping or this guy is writing backward^ That in itself is impressive. The video itself is also quite good - I am to implement a map data structure using AVL trees. I think this makes the gist of it really clear. Thanks.
@BrianFaure1
@BrianFaure1 7 жыл бұрын
Pretty sure he's just writing regularly then flipping the video horizontally in post-production.
@MrSkopelos27
@MrSkopelos27 7 жыл бұрын
Yeah it's mirrored. Look at the Nike logo on his tshirt.
@ahmadbukhari2809
@ahmadbukhari2809 3 жыл бұрын
This guys is great, all the videos are super helpful but this method does not make sense. There are soo many missing validation and there are missing points.
AVL Tree 7 complete example of adding data to an AVL tree.
20:47
AVL Trees & Rotations (Self-Balancing Binary Search Trees)
20:38
Back To Back SWE
Рет қаралды 362 М.
Wednesday VS Enid: Who is The Best Mommy? #shorts
0:14
Troom Oki Toki
Рет қаралды 50 МЛН
10.1 AVL Tree - Insertion and Rotations
43:08
Abdul Bari
Рет қаралды 1,3 МЛН
Trees  and heaps 1 Introduction
4:13
RobEdwards
Рет қаралды 20 М.
AVL Bäume + Rotation
18:38
bleeptrack
Рет қаралды 104 М.
AVL Trees Simply Explained
11:53
Maaneth De Silva
Рет қаралды 194 М.
AVL trees in 9 minutes - Insertions
9:00
Michael Sambol
Рет қаралды 52 М.
Предел развития НЕЙРОСЕТЕЙ
18:53
Onigiri
Рет қаралды 206 М.
Understanding B-Trees: The Data Structure Behind Modern Databases
12:39