Red-black trees in 6 minutes - Delete Fixes

  Рет қаралды 50,288

Michael Sambol

Michael Sambol

Күн бұрын

Пікірлер: 33
@raashid_07
@raashid_07 4 ай бұрын
My college professors should take tuition from you. Thankyou so much for these easy and short explanation videos
@ttv9329
@ttv9329 2 жыл бұрын
Insane coincidence. Got an exam tomorrow and just found out this is going to be a topic. Kinda panicked coz I had no idea what the hell red and black trees were. Funny how you posted this EXACTLY when I needed it.
@MichaelSambol
@MichaelSambol 2 жыл бұрын
boom!
@sequbeats
@sequbeats 2 жыл бұрын
Wooow lol. Same here. Where are you from? :)
@siddhantyadav450
@siddhantyadav450 2 жыл бұрын
lol sameeee. i have an exam in 10hours and he coincidently resumed his 5yr old playlist this week. damn
@ttv9329
@ttv9329 2 жыл бұрын
@@sequbeats Germany!
@ttv9329
@ttv9329 2 жыл бұрын
@@siddhantyadav450 Same, been binging his content
@flower77769
@flower77769 2 жыл бұрын
Those tutorials are top notch. Thanks for uploading!
@Ari-pq4db
@Ari-pq4db 4 ай бұрын
This is by far the best video on the internet to explain this in such a short amount of time !!!!!!!! THANK YOU SSOOOOOO MUCHHHH SIR ❤❤❤
@ramiltaghiyev9712
@ramiltaghiyev9712 Жыл бұрын
So, we call the fix up only if the y's color is black, but what is y on the example from 1:03? Thanks
@thecoconutkid8416
@thecoconutkid8416 2 жыл бұрын
A multilevel-feedback-Queue rundown would be much appreciated!
@ShubhamShrikantBawner
@ShubhamShrikantBawner 2 жыл бұрын
You are missing a crucial point in almost all videos, If root is red, simply recolor it to black. instead of saying that this is smaller part of bigger tree... you can do this at 3.46
@DCM-fo3ve
@DCM-fo3ve 2 жыл бұрын
Exactly! I made many questions wrong.
@ReverseGuy
@ReverseGuy 2 жыл бұрын
@@DCM-fo3ve is this mistake made in insert videos also?
@DCM-fo3ve
@DCM-fo3ve 2 жыл бұрын
@@ReverseGuy Yes!
@ReverseGuy
@ReverseGuy 2 жыл бұрын
@@DCM-fo3ve nope, the insertion videos are correct
@ruochenhuang9881
@ruochenhuang9881 7 ай бұрын
The author's delete_fixup function considers your case -- at the end of type 2, moving x to its parent, then we go back to while's determine statements. Because now x is the root, so we circumvent and jump over the "while", set x(root)'s color to black.
@narenbabu629
@narenbabu629 2 жыл бұрын
Can you do a explanation on AVL Tree
@Souravjaiswal-j4w
@Souravjaiswal-j4w Жыл бұрын
It can be better if you had used P, GP and uncle's example like done in insertion and what happens if P is red , clarify this case.. overall like it .. Thank you.
@stephenhowe4107
@stephenhowe4107 2 жыл бұрын
Not covered in these cases is what happens if P is red. If it is then w is automatically black and has to be a real node not a leaf node (otherwise black path count is incorrect) => P becomes black, w becomes red and delete is over (as there is now an extra black in X path fixing deficiency). delete _fixup applies to the one case that is real work => when you delete a black node and it is a leaf node and not the root node. Also Red-Black deletion fixup is a 2-prong strategy. (i) You are looking a red node in Parent, Sibling, Siblings-Children. If you find one you can via rotation and/or recolouration get the red node and move as black node to the tree that lacks a black node, delete fixup over. Red Black delete requires a maximum of 3 rotations. (ii) But what happens if Parent, Sibling, Siblings-Children are all black? Then recolour the Sibling red and the Parent is now the new node to fix. You have effectively made both sides of the tree "bad " and you are closer to root. A new set of nodes are now Parent, Sibling, Siblings-Children. And what happens if you never encounter a Red node? You arrive at the root. Then the tree is now restored, the black path count decreases by 1. You have introduced a Red node in every path. Of course suppose you do (ii) 5 times before finding a red node. The algorithm does the minimum to restore before quitting on the 6th move upwards towards the root.
@ReverseGuy
@ReverseGuy 2 жыл бұрын
it is covered dumb.as
@michealnestor4440
@michealnestor4440 Жыл бұрын
I think it would have been better for you to take a more abstract approach to teaching the topic like the old videos, and introduced the code afterwards. Especially the transplanting in the last episode. I think it would be easier to have understood if you said: "There are 3 cases for deletion, if the node you want to delete has a nill left child then replace it with its right child, if it has as nill right child then replace it with its left child, else replace it with the min in its right sub tree.", and then introduced how to actually code it.
@dinesh.p8642
@dinesh.p8642 10 ай бұрын
respect. would have been better, if explained why we have that logic inside each case, i mean how are we supposed to remember that? whats the idea.
@KhaledAhmed-cs8rv
@KhaledAhmed-cs8rv Ай бұрын
The video doesnt say what w and x in a tree after delete are!
@marcosteixeira7321
@marcosteixeira7321 Жыл бұрын
what if x or w is nil
@yipyiphooray339
@yipyiphooray339 Жыл бұрын
then we blow up
@alanturing487
@alanturing487 Жыл бұрын
So, th cod is incorrect? We really will get null pointer exception in fix up method? @@yipyiphooray339
@TorpedOvrn
@TorpedOvrn Жыл бұрын
quite helpful video but you explained case 2 wrongly. check last line of your code: you should paint last x to black after you exit from cycle, so 5 should be black and there won't be two adjacent red nodes.
Red-black trees in 8 minutes - Deletions
8:13
Michael Sambol
Рет қаралды 122 М.
B-trees in 6 minutes - Deletions
6:00
Michael Sambol
Рет қаралды 70 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН
Analyzing algorithms in 6 minutes - Intro
6:29
Michael Sambol
Рет қаралды 13 М.
Understanding B-Trees: The Data Structure Behind Modern Databases
12:39
CS50x 2025 - S1, C Fundamentals
19:58
Solidity Academy
Рет қаралды 24
Red-black trees: Samuel's tutorial
24:20
Samuel Albanie
Рет қаралды 11 М.
Red-black tree deletion: steps + 10 examples
23:46
Alena Chang
Рет қаралды 13 М.
Heaps in 6 minutes - Methods
5:56
Michael Sambol
Рет қаралды 94 М.
Red-black trees in 5 minutes - Insertions (strategy)
5:38
Michael Sambol
Рет қаралды 506 М.
Binary search in 4 minutes
4:00
Michael Sambol
Рет қаралды 148 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН