Lecture 6: AVL Trees, AVL Sort

  Рет қаралды 671,808

MIT OpenCourseWare

MIT OpenCourseWare

Күн бұрын

MIT 6.006 Introduction to Algorithms, Fall 2011
View the complete course: ocw.mit.edu/6-0...
Instructor: Erik Demaine
License: Creative Commons BY-NC-SA
More information at ocw.mit.edu/terms
More courses at ocw.mit.edu

Пікірлер: 319
@sergeykholkhunov1888
@sergeykholkhunov1888 3 жыл бұрын
02:50 height of a tree 06:40 height of a node 10:40 AVL tree 14:40 AVL tree balanced 29:00 AVL insert example 32:45 rotation 40:05 general AVL insert 48:42 AVL sort
@aslon1213
@aslon1213 2 жыл бұрын
@adonis1168
@adonis1168 7 жыл бұрын
all those beautiful mornings ruined for stupid classes whilst i could have listened to this guy at my warm bed with a cup of coffee at my hand. smh
@akntokluoglu2851
@akntokluoglu2851 5 жыл бұрын
Mesele dersi dinlemek değil aynı dersi aynı şekilde başka yerde de dinleyebilirsin
@LucasRibeiro-qb8bj
@LucasRibeiro-qb8bj 3 жыл бұрын
Dude, I'm feeling it right now during the class, my professor is kinda bad
@debasishghoshsays
@debasishghoshsays Жыл бұрын
I am thinking the same blud lol
@adityamaheshwari4250
@adityamaheshwari4250 16 күн бұрын
Literally!!
@DaxXx988
@DaxXx988 10 жыл бұрын
@45:00- it should be LeftRotate(x), not Right
@DeshRaj-sr1hy
@DeshRaj-sr1hy 10 жыл бұрын
Yeah, exactly. I am surprised none of the students pointed that out, even though it's MIT.
@anonymoose_yt
@anonymoose_yt 10 жыл бұрын
I went back and forth from 45:00 to the part where he did the left-rotate(x) originally and was sure I'd missed something. Thanks for clarifying. MIT's KZbin videos are some of the few with comments that are actually useful :-).
@Qladstone
@Qladstone 7 жыл бұрын
This needs to be upvoted to the top of the comments section.
@capetaquebratudo
@capetaquebratudo 6 жыл бұрын
RR means you have to left rotate, its used RR notation because you add a node to the RIGHT twice.
@yawofori-addae3888
@yawofori-addae3888 6 жыл бұрын
so is everything else he says after right? with reference to the trees he drew
@rfigueiredo
@rfigueiredo 23 күн бұрын
Watching 11 years after the video was released, and still relevant and high quality content, thank you.
@acur665
@acur665 7 жыл бұрын
It blows my mind that people can essentially get a free MIT education from these lectures. Thanks for all the CS lectures & the rest of the online courses! I look forward to absorbing as much knowledge as I can from them!
@Mmspuff
@Mmspuff 5 жыл бұрын
i swear this is the best algorithm lecture you could ever find on internet!! I tried paid courses from other top universities and they are not nearly half as clear as MIT!!!! great MIX of concept and image rather than plain formulas and calculations!!
@shady1080
@shady1080 9 жыл бұрын
I love this guys, so enthusiastic about what he's teaching!
@keshav885
@keshav885 3 жыл бұрын
He’s a child prodigy for no reason
@nomadshubham3907
@nomadshubham3907 3 жыл бұрын
Unlike indian profs 🔥🔥
@莊涵盛-n6u
@莊涵盛-n6u 3 жыл бұрын
SO good to see those teachers would take time to encourage students to pause and think what just happened
@qiguosun129
@qiguosun129 2 жыл бұрын
Thank you, Erik Demaine. Your courses are always so clear and intuitive!
@CEngineer2010
@CEngineer2010 9 жыл бұрын
@44:57 its called a left rotate of x. Not right rotate. He goofed up.
@RC_Cola2020
@RC_Cola2020 9 жыл бұрын
CEngineer2010 This caused me so much confusion! I agree that he reversed them.
@chengweili9516
@chengweili9516 9 жыл бұрын
+CEngineer2010 Yes. That's a left rotate of x!
@AmbarMehrotra1
@AmbarMehrotra1 9 жыл бұрын
+CEngineer2010 Thanks man! I was so confused about that!
@TasdiqueChowdhury
@TasdiqueChowdhury 9 жыл бұрын
+CEngineer2010 super upvote. this is really important lolol
@user13823
@user13823 8 жыл бұрын
+CEngineer2010 when I was a student, I often found mistakes in notes which I made at lectures. And I used to think: "o, the professors are so silly, even me, ordinary student, find stupid mistakes in what they teach". Everything reversed when I started to teach. I cannot explain this exactly, but something like magic happens. When you stand near the board and teach, you sometimes forget trivial things, and do such silly and stupid mistakes that even you cannot understand how that happens. It is not that easy to stand near the board and explain something to other people.
@melvin6228
@melvin6228 5 жыл бұрын
05:42 that jump though #secret_teaching_skills
@codewing
@codewing 10 жыл бұрын
Thanks a lot! Way better then my prof in germany... Amazing how much better motivated ppl. can teach stuff! Keep up the good work!
@bluesystemjackson
@bluesystemjackson 5 жыл бұрын
Ja, ich glaub die haben da auch ein ganz anderes Verhältnis als in Deutschland. Die Studenten dürfen ihn mit Vornamen anreden (es noch weitere Videos, aus dieser Vorlesungsreihe, wo er mehrfach mit "Erik" angesprochen wird", er redet mit denen Studenten, versucht einen lebendigen Vortrag zu entwickeln etc. Kein blödes Rumgedrücke mit Folien und Laserpointer, wie es in Deutschland gelehrt wird, sondern richtige Herleitungen Schritt für Schritt. Massachusist müsste man sein^^
@kazenohito7641
@kazenohito7641 8 жыл бұрын
Oh my god I wish my instructor was like this. I swear my csc instructor just pulled rotations out of his mitochondria and did not explain a lick of how they work.
@ninatsvetkova
@ninatsvetkova 8 жыл бұрын
At least you learn about the avl tree in your university...
@eRaZerrOfficial
@eRaZerrOfficial 8 жыл бұрын
same dude...same...At least your teacher speaks
@ra1zoo
@ra1zoo 7 жыл бұрын
at least you went to university...
@ausseriridische976
@ausseriridische976 7 жыл бұрын
Haha this is why I believe this video has so many views :[
@bluesystemjackson
@bluesystemjackson 5 жыл бұрын
@@Wes-Tyler "Bad english is the language of science"
@aliaj.shafira7203
@aliaj.shafira7203 5 жыл бұрын
Thank you for this video, MIT! It helps me a lot to understand the material. And thank you to Mr. Demaine for the explanation. Your explanation is understandable.
@zhanghewnn
@zhanghewnn 10 жыл бұрын
It is a enjoyment to watch Erik's lecture! Greetings from Dalhousie!
@arashjamshidi3249
@arashjamshidi3249 5 жыл бұрын
I love how the professor is kinda dancing while cleaning the board @ 26:05
@op1ekun81
@op1ekun81 8 жыл бұрын
At 45:00 isn't it LEFT ROTATION of X instead of RIGHT ROTATION of X? UPDATE: Already pointed out by DaxXx988 in the comments below. Thanks!
@mash2068
@mash2068 7 ай бұрын
Dude I thought I was the only one. The teacher, towards the end, was tired and as confused as the rest of us.
@IgnisArdor
@IgnisArdor 8 жыл бұрын
I'm a Maths student from Italy and my exam is tomorrow! thank you so much for sharing these!! they're so useful!!
@tryingtocorrect
@tryingtocorrect 8 жыл бұрын
But why did you leave it to the last moment? :)
@IgnisArdor
@IgnisArdor 8 жыл бұрын
I had been studying for a month, i was revising. Passed it.
@darshanbhatt6293
@darshanbhatt6293 8 жыл бұрын
g
@chas7618
@chas7618 5 жыл бұрын
Thanks MIT and prof. Erik for the fantastic lecture on AVL trees
@angelc4794
@angelc4794 5 жыл бұрын
For some reason the Frisbee cushions bring me such joy. xD
@bachirmasry6233
@bachirmasry6233 9 жыл бұрын
If we could listen to the students remarks and questions, that would make this video in my opinion mush more beneficial.
@Hamza-qk9yq
@Hamza-qk9yq 6 жыл бұрын
You can turn on the subtitles, it shows what the students are saying
@w1d3r75
@w1d3r75 4 жыл бұрын
There must be some sort of translations in the course's website
@sexy_jindwala1068
@sexy_jindwala1068 3 жыл бұрын
One of the finest videos on AVL Trees I have ever seen! Those who dont understand should not study, leave everything, Go Fishing!
@yajurphullera9396
@yajurphullera9396 4 жыл бұрын
25:39 "Now if you don't know fibonacci numbers, I pull a 'rabbit' out of a hat and..." I see what you did here Eric.
@sonikaagarwal931
@sonikaagarwal931 6 ай бұрын
I study at UNIMELB and this is so much better...and this is in 2011.
@NikhilKumar-fj2dg
@NikhilKumar-fj2dg 8 жыл бұрын
Thanks a lot professor for solving my doubt of AVL Tree and also thanks to MIT
@リンゴ酢-b8g
@リンゴ酢-b8g 2 жыл бұрын
A balanced binary tree, also referred to as a height-balanced binary tree, is defined as a binary tree in which the height of the left and right subtree of any node differ by not more than 1.
@reydavid7300
@reydavid7300 4 жыл бұрын
24:50 a random n appears in the reasoning whereas we were always talking in terms of N_h, h, and phi. He meant phi^h / sqrt(n) < N_h
@Bargains20xx
@Bargains20xx 4 жыл бұрын
i got confused for a while, maybe thats what reviews are for
@bsethupathi1
@bsethupathi1 5 жыл бұрын
31.57 : "This guy is doubly left heavy. Hmm, Bad News." Cracked me up.
@websoftwaredeveloperijtiha3093
@websoftwaredeveloperijtiha3093 2 жыл бұрын
It's so cool that these top schools release courses like this one online free of charge. I may not get a chance to go to MIT
@johnxina7496
@johnxina7496 11 ай бұрын
yeah no shit
@WS-lv4kk
@WS-lv4kk 6 жыл бұрын
At 46:55, and was noted at another point earlier that there may be an imbalance in the higher levels of a tree if an imbalanced node is balanced at a lower level of the tree. Is that really true in a properly coded AVL tree? A properly coded AVL tree is balanced at the moment of insertion. After insertion, node X is imbalanced because of, let's say, right-heavy right subtree Y. After rotation(s), Y is now at the previous location of X, and Y has the same height as X before the insertion. This is because Y's height increased by 1 as a result of insertion, and now has the same height as X before insertion. Moving Y to replace X in the rotation means the height at the NODE OF ROTATION does not change. Therefore, the only way that there could be further imbalance up the tree is if the tree was already imbalanced before insertion.
@anmolsharma9539
@anmolsharma9539 4 жыл бұрын
MIT &Erik you owe me for this!! Don't judge by edit sign on comment i misspelled Erik Lol😁
@scottwells9340
@scottwells9340 8 жыл бұрын
@31:30 "now all the heights change... and it's annoying to draw what the heights are... but... I'll do it"
@ethannetz4961
@ethannetz4961 8 жыл бұрын
Yes I also watched the video
@minksq4026
@minksq4026 7 жыл бұрын
Those tree nodes are so cute
@tc07client5
@tc07client5 6 жыл бұрын
Erik's explanations are great! Thanks to MIT.
@PamirTea
@PamirTea 7 жыл бұрын
Tree rotation is magic.
@coder-wolf
@coder-wolf 2 жыл бұрын
I really liked his personality. A great attitude to have as a teacher. I wish my university had more teachers like him.
@sagnikbhattacharya6725
@sagnikbhattacharya6725 4 жыл бұрын
guy walking in at 1:50 is a treat!
@shrikantsarma27
@shrikantsarma27 8 жыл бұрын
Damn good prof. ... Need more videos from him !
@MarcusLucasOficial
@MarcusLucasOficial 4 жыл бұрын
Log (n) = height for balanced trees. On the example on 5:20, there are 15 nodes, height is 4, but Log(15) = 3.90689059. Wouldn't it be height = Log (n+1) ? What am I missing? Or "+1" is considered a constant, so it is not inserted into the equation?
@YiANgO5
@YiANgO5 4 жыл бұрын
after 7 years , still excellent
@parthinbaraiya7114
@parthinbaraiya7114 4 жыл бұрын
AVL FULL CODE C/C++ kzbin.info/www/bejne/mqHGaYqiZZ6bhdk
@yashwanthmendu9939
@yashwanthmendu9939 Жыл бұрын
Yes it is
@vothuong08
@vothuong08 6 жыл бұрын
thanks MIT & professor for this video
@TheTownLord
@TheTownLord 11 жыл бұрын
Very strong lecture! Clearly understandable and Smooth
@bluesystemjackson
@bluesystemjackson 5 жыл бұрын
Viel besser als unsere Algorithmentheorie-Vorlesungen
@kevinbeteta1737
@kevinbeteta1737 7 жыл бұрын
Another reason to give NULLPTR a value of negative one is that you have to move upward once to get to a genuine leaf.
@rudymagasrevy2110
@rudymagasrevy2110 11 жыл бұрын
this guy is a magician with chalk
@malikalamgirian
@malikalamgirian 8 жыл бұрын
At 46.00 is a left rotate, not a right rotate
@capetaquebratudo
@capetaquebratudo 6 жыл бұрын
RR means you have to left rotate, its used RR notation because you add a node to the RIGHT twice.
@arnobchowdhury9641
@arnobchowdhury9641 5 жыл бұрын
Personal Timestamp: Rotation 32:44 Rebalance 43:00
@SneakyMrSnake
@SneakyMrSnake 9 жыл бұрын
Great lecture! Really helped to understand AVL trees for my exam
@mikkelrivera
@mikkelrivera 11 жыл бұрын
I think he may have made a mistake. He defines N(h) as the minimum number of nodes in an AVL tree of height h. In my opinion N(h) = 2^(h - 1) + 1 (I think a student suggested that but he never really elaborated on why that was wrong). As I see it, you take the perfectly balanced tree of height h - 1, and you add only 1 node to increase the height by 1.
@shivamkendre2433
@shivamkendre2433 5 жыл бұрын
Nice lecture I got clear image in my mind. Thank you so much sir
@ckim336155
@ckim336155 5 жыл бұрын
Literally a genius.
@suramshivakumarreddy
@suramshivakumarreddy 10 жыл бұрын
i'm very impressed by the way u taught :)
@jonsmith1271
@jonsmith1271 5 жыл бұрын
Thanks for explaining this. I can't believe how those students just wonder in late ,, given the opportunity they have
@TheMasterfulcreator
@TheMasterfulcreator 5 жыл бұрын
because it gets filmed and put online.
@jonsmith1271
@jonsmith1271 5 жыл бұрын
@@TheMasterfulcreator ?
@TheMasterfulcreator
@TheMasterfulcreator 5 жыл бұрын
@@jonsmith1271 i'm saying i probably wouldn't worry too much about seeing the entire lecture if it all gets recorded and put online anyway
@gamereplayhq
@gamereplayhq 7 жыл бұрын
Beautifully explained
@tjfirhfjejUTH24
@tjfirhfjejUTH24 11 жыл бұрын
he also blows glass. like a badass
@rosasmellshaha
@rosasmellshaha 6 жыл бұрын
He really loves that board
@henrikarboejensen812
@henrikarboejensen812 Жыл бұрын
28:05 Nh (min) : 1 2 4 12 20 33 .. etc. ( 1 +33 + 20 ) = 54 etc. etc. ( 1 + 54 + 33 ) = 88
@prateeksinghal630
@prateeksinghal630 5 жыл бұрын
And the people said that you have to become a nerd to be smart and here we have Eric :P
@dmcmanam
@dmcmanam 7 жыл бұрын
AVL Insert algorithm is incorrectly described as possibly requiring more than 1 or 2 rotations and having to travel up to the root. After 1 or 2 rotations retracing is done. I skimmed the video waiting for delete() and it isn't there, delete rotations can introduce further imbalances up the tree. For an example of the insert see: refactoringlightly.wordpress.com/2017/11/05/rank-balanced-avl-trees-on-github/
@Simon0725
@Simon0725 5 жыл бұрын
Yeah, you're right about the amount of rotations required after inserting a new element. I was confused when he said about needing to traverse the AVL up in order to find any new imbalances so I was looking for a comment like yours to confirm my doubt xD
@seinj9013
@seinj9013 9 жыл бұрын
40:47 - not sure it's correct that "we might have to do more than 2 rotations" after a violation fix, the tree should become re-balanced again
@mlazowik
@mlazowik 9 жыл бұрын
+korvix He explains that just after what you quoted. By adding a node you make all of the (left or right) subtrees of nodes on path from root to the added node larger. This one violation fix fixes only one of these subtrees. Others might have to be fixed too. Otherwise each operation would have a constant complexity. That'd be lovely, but unfortunately it's not true :(
@danyalette1369
@danyalette1369 6 жыл бұрын
yes you are correct: when a node is balanced after an insert, it will have the same height as before the insert, so after doing a post-insertion rebalancing of the first unbalanced node, you can terminate. in contrast, with deletion, you need to rebalance all ancestors.
@armathur259
@armathur259 6 жыл бұрын
Earlier i was sad :( now m happy :) thanks Erik
@ShubhamSinghYoutube
@ShubhamSinghYoutube 4 жыл бұрын
Lol, good to see your tree got balanced
@PuneetJainfca
@PuneetJainfca 10 жыл бұрын
The lecture is AWESOME. but yeah, the LR thing and the heights of that tree in the question.. that isn't (h-3)... else the right child would be left heavy.. (lesser the height, lower it is..).... just my point of view.... I love these lectures :D
@lockersrandom6161
@lockersrandom6161 4 жыл бұрын
Thank you MIT.
@hannahmuthoni192
@hannahmuthoni192 13 сағат бұрын
This was a really fun lecture. Damn
@YasserSinjab
@YasserSinjab 2 жыл бұрын
who else here enjoy Erik lectures :)
@apartment_prishtina
@apartment_prishtina 11 жыл бұрын
cushions, everytime they get a right answer they get a cushion because the seats they sit on are hard seats.
@gutierreznunezdavidisrael2511
@gutierreznunezdavidisrael2511 4 жыл бұрын
Amazing! Greetings from Mexico.
@chipbk10
@chipbk10 6 жыл бұрын
The more important thing should be mentioned here is how AVL applied in the real problems, and why we choose AVL to solve? The implementation is just after that. I never learn a thing that I don't know how important it is.
@nbafanboi23
@nbafanboi23 8 жыл бұрын
I can tell that the students are pretty smart, just comparing it to my class at University of Waterloo. Although I can't tell if its the same students answering the question. I know that I would be clueless for half these questions.
@ziliestarrive
@ziliestarrive 5 жыл бұрын
Waterloo is a pretty damn good school.
@Ahmed-zq2vo
@Ahmed-zq2vo 4 жыл бұрын
I feel like I took a minor in CS because of this guy
@Jorgetime
@Jorgetime 11 жыл бұрын
This teacher is awesome
@jasondads9509
@jasondads9509 6 жыл бұрын
Wow MIT lecturers are good
@Movewithkhu
@Movewithkhu Жыл бұрын
keep the height order log n to keep the left n right tree balanced
@ashutoshtiwari4398
@ashutoshtiwari4398 4 жыл бұрын
At 27:30 , how did he get N(h) > 2*N(h-2) to N(h) > theta(2 ^ (h/2) )
@--ShivaS
@--ShivaS 3 жыл бұрын
did you get the answer for it ?
@reik2006
@reik2006 Жыл бұрын
N(h) > 2 * N(h - 2) > 2 * (2 * N(h - 4)) > 2 * (2 * (2 * N(h - 6))) > ... > 2^k * N(h - 2k) for some non-negative integer k and recurrence ends when N(h - 2k) reaches base case N(0) for k = h/2.
@AniRec-e8u
@AniRec-e8u 2 ай бұрын
@reik2006 thanks bro i had same doubt
@woshikakadong
@woshikakadong 6 жыл бұрын
I love this prof
@ericbelrose1984
@ericbelrose1984 10 жыл бұрын
Why didn't he start with a balanced tree. Is it not true that before he inserted the 23 the tree was already off balance. The tree was left heavy. I am still just starting the study of this structure, but it would seem that the tree would have to left rotate at 20 so 29 becomes it's parent and 26 joins it. Then the left subchild of the left subtree is heavy so it would right rotate so 29 becomes the head. Maybe it is because he knew he was going to add the 55 and didn't care that he didn't start balanced. If he did that rotation first the tree would be a perfect tree after adding the 55. Perhaps I'm confused. It would seem that you could improve the algorithm simply by looking beyond the max{HR,HL}. Could you not calculate optimal tree height for N and if max height after walking down to insert in the BST fashion is worse, then start rotations on the max height side. First step towards that side being heaviest in that side (left heavy where left is the issue/right heavy where right is the issue), then balance the head node by rotating away from the heaviness. Is there another name for that tree balancing algorithm.
@melode221
@melode221 9 жыл бұрын
Eric Belrose The tree at start point is not complete balanced, but is indeed `AVL balanced` which means it obeys the constraint of AVL tree, so it is a possible real world case you'll dealing with.
@EXHellfire
@EXHellfire 5 жыл бұрын
the tree was left heavy but only by a factor of 1 over the right side. The idea is to keep the lack of balance either 0 or 1 to either side, but not larger than that 1. Otherwise if you forced a perfect balance of 0 at all times, you would be entirely unable to modify the tree, since you can't add two nodes at the same time, and if you did, you'd have to then add four nodes at the same time the next time and so on. If you allow it to be left or right heavy by at least a factor of 1 then you can add nodes as you go and then rebalance the tree if it's necessary, because you allow it to have empty spots. If that wasn't the case, say you have only the root node, and you want to add a child to it. You just can't, because that'd already make it either right or left heavy from the start, and so that would break the 0 balance factor.
@yyyyzzzzify
@yyyyzzzzify 11 жыл бұрын
Have a doubt about BST in this lecture, where professor writes >=x and < =x that shows nodes in left subtree are equal or less than its parent...same on another side. Isn't BST supposes to have no duplicate nodes, which means nodes in left subtree must be less than its parent not equal or less, and nodes in right subtree must be greater than its parent not equal or greater?
@Stu49583
@Stu49583 9 жыл бұрын
great teacher
@gosumadman
@gosumadman 10 жыл бұрын
Can someone explain 26:09?I don't get why he changed N(h-1) to N(h-2) and removed the 1. Also I don't get how 2N(h-2) = (2^(h/2)
@jonsnow9246
@jonsnow9246 7 жыл бұрын
Yes,but how?
@hangchen6131
@hangchen6131 7 жыл бұрын
Thanks! By the way, why h is decreasing by 2? Why the second line should be N(h-4) instead of N(h-3)??
@jilongzhang1851
@jilongzhang1851 6 жыл бұрын
it is more convenient to use log, I guess. If you use N(h-3), then you get N(h) > 2*N(h-3), nothing helpful
@jiaweizhou9084
@jiaweizhou9084 6 жыл бұрын
Becase N(h) > 2N(h-2) and h replaced by h-2, the righthand side becomes N(h-4). Actually you can write this process as N(h) > 2N(h-2) > 2*2*N(h-4) until N(0)
@u40165
@u40165 5 жыл бұрын
Sagar Theurkar Thanks a lot! I had a same question and little trouble to derive the last from the first. It was not only me who have the same.
@nilspin
@nilspin 9 жыл бұрын
"Life is good."
@ShubhamSinghYoutube
@ShubhamSinghYoutube 4 жыл бұрын
There's no feeling more merrier than successfully balancing an AVL tree. 🥺😂Lol
@overwhelmingsarcasm
@overwhelmingsarcasm 6 жыл бұрын
He sometimes switches between 'depth' and 'height', but the depth or level of a node is it's distance going down from the root, right? Also I've seen different ideas about whether the root of a tree is at level/depth 0 or - 1. Is there a widely accepted consensus on which should be used or is it just a matter of consistency with the formula/algorithm in the same way that null nodes were defined to have height - 1 here? The notation and terminology around this topic is a tad confusing...
@prasanna5836
@prasanna5836 6 жыл бұрын
I think level and depth are same but height and depth are different.That -1 theory for null nodes is widely accepted and about that root being at level -1,I've never come across any algorithm which assumes the level/ depth of root of a tree as -1.
@isbestlizard
@isbestlizard 4 жыл бұрын
Erik de MAN!
@isbestlizard
@isbestlizard 4 жыл бұрын
I like people who write individual letters, never trusted cursive
@umarfarooq3283
@umarfarooq3283 4 жыл бұрын
I should have just joined MIT dayummmm
@alawy5551
@alawy5551 2 жыл бұрын
You can see the difference between learning data structures Now and in the past I learend AVL trees in 20 min video with good animation and easy to understand And i don't need to write it all on paper! I just take a screenshot and organize it on Notion Thanks allah for these changing
@Dinesh-ng6pb
@Dinesh-ng6pb 2 жыл бұрын
bro can you please tell me which channel or website to find the video with animations
@harshsharma03
@harshsharma03 2 жыл бұрын
you're clearly at the wrong place if you think 20min animation videos are greater than these gems of lectures. I specifically choose to watch these because they are raw and make my brain work more, which helps me understand them much more deeply than I would otherwise.
@LRP-84
@LRP-84 5 жыл бұрын
Very nice your lecture
@micmicmic7
@micmicmic7 11 жыл бұрын
Great lecture, thank you very much!
@ga63r4h
@ga63r4h 11 жыл бұрын
if node height = max height of the left + max height of the right + 1 shouldn't the root of the tree at 9:35 = 4 and not 3?
@jungsuheo5874
@jungsuheo5874 8 жыл бұрын
Is Erik out there? or could someone help me? I have a question. At 45:20, RR(x) should be changed to LR(x) or RR(y)? it violates 35:21 Thanks.
@tannernewton8543
@tannernewton8543 8 жыл бұрын
It should be LR(x) RR(y) would be something completely different but you are correct
@geekoist
@geekoist 11 жыл бұрын
@4:45 when writing the inset operation Erik got the direction wrong. It's a left rotation
@jazzvids
@jazzvids 6 жыл бұрын
at 42:50 didn't he mean that the left sub tree is -1 and the right one is -1 and that's why it comes out -2? If it was 0 like he says then the node would be balanced
@jazzvids
@jazzvids 6 жыл бұрын
also at 44:20 it seems like if you're AVL tree is good, it will never happen that node x is unbalanced and at the same time x's right child will be balanced.
@anonymoususer5402
@anonymoususer5402 7 жыл бұрын
Thanks a lot Sir.
@TonyNguyen-mc8bh
@TonyNguyen-mc8bh 11 жыл бұрын
BST has not a same Node...X-node can't equal X-Root in this case
@7yep4336dfgvvh
@7yep4336dfgvvh 2 жыл бұрын
Good stuff, thanks bro
@Cnidaria14
@Cnidaria14 11 жыл бұрын
no if you look at the maximum height of the children it is 2(maximum) since the last node has a height of 0. ok?
@windowslogo3577
@windowslogo3577 6 жыл бұрын
33:00 mind blown inc
@adsk2050
@adsk2050 6 жыл бұрын
40:23 - Watch from this part next time
@Zetzumarshen
@Zetzumarshen 4 жыл бұрын
avl insert example: 36:03
@amrabdulaziz2253
@amrabdulaziz2253 8 жыл бұрын
thank you
@duneworker2195
@duneworker2195 5 жыл бұрын
Saved my live
@xenobob2773
@xenobob2773 4 жыл бұрын
Wow...a full room of people with 750+ SAT Math scores.
Lecture 7: Counting Sort, Radix Sort, Lower Bounds for Sorting
52:09
MIT OpenCourseWare
Рет қаралды 405 М.
AVL Trees & Rotations (Self-Balancing Binary Search Trees)
20:38
Back To Back SWE
Рет қаралды 352 М.
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 2,1 МЛН
Из какого города смотришь? 😃
00:34
МЯТНАЯ ФАНТА
Рет қаралды 2,6 МЛН
Lecture 1: Algorithmic Thinking, Peak Finding
53:22
MIT OpenCourseWare
Рет қаралды 6 МЛН
MIT's AI Discovers New Science - "Intelligence Explosion"
11:11
Matthew Berman
Рет қаралды 143 М.
Lecture 13: Breadth-First Search (BFS)
50:48
MIT OpenCourseWare
Рет қаралды 706 М.
Understanding B-Trees: The Data Structure Behind Modern Databases
12:39
Lecture 8: Hashing with Chaining
51:16
MIT OpenCourseWare
Рет қаралды 601 М.
AVL trees in 9 minutes - Insertions
9:00
Michael Sambol
Рет қаралды 48 М.
Lecture 19: Dynamic Programming I: Fibonacci, Shortest Paths
51:47
MIT OpenCourseWare
Рет қаралды 2,8 МЛН
10.1 AVL Tree - Insertion and Rotations
43:08
Abdul Bari
Рет қаралды 1,2 МЛН
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 2,1 МЛН