5.16 Red Black tree | Introduction to Red Black trees | DSA Tutorials

Поделиться
HTML-код
  • Опубликовано: 14 янв 2025

Комментарии • 721

  • @83vbond
    @83vbond 4 года назад +288

    I am studying IT in Australia currently. This is the first video I found on Red-Black trees where I actually understood the topic because you start from the basics and give lots of examples. Thanks and gratitude from Australia!
    Also, the last question tree is not Red-Black because the left NIL child of 15-node creates a black path that is of different length. Very good question, makes a person think deeply. Keep up the great work!

  • @Myersatthedoor
    @Myersatthedoor 5 лет назад +48

    Videos like these make going to college absolutely unnecessary.
    Stupendous work!

    • @eddyecho
      @eddyecho 4 года назад +12

      This is only true for people that already know exactly what to study to learn what they want to learn. Otherwise I can't see how someone who has no prior knowledge would even know to search for this video or have any appreciation for it. I suppose someone could read an introductory textbook but most people don't do that.

    • @yeswhynot319
      @yeswhynot319 2 месяца назад +1

      @@eddyecho syllabus is a thing lol

  • @kdoxfkck
    @kdoxfkck 3 года назад +28

    Seriously.....you are too good at teaching....I rarely appreciate people....but u deserve not only appreciation but also a heart❤️❤️... Thankyou so much ma'am for your precious teaching...🙏🙏

  • @vikas420mudimela9
    @vikas420mudimela9 5 лет назад +26

    The most intelligent approach that i have never seen in my academic year

  • @abs80900
    @abs80900 4 года назад +23

    In all the languages spoken on earth, THANK YOU SO SO SO MUCH!!!!!!

  • @mobooya
    @mobooya Год назад +3

    Thanks!

  • @anuragtiwari2511
    @anuragtiwari2511 4 года назад +83

    dont know someone said this to you or not but, i would say best explanation ever heard....Appreciations:)

  • @chrischauhan1649
    @chrischauhan1649 3 года назад +9

    This is one of the best explanation of the Red-Black tree on the internet. Kudos to you.

  • @ashu7pathak
    @ashu7pathak 4 года назад +85

    Awesome lesson, as answer to your question @ 32:43, it's not following 4th property as there is a left NIL node of 15 having only 1 Black node from root to NIL leaf node, all others have 2!

    • @indiai078
      @indiai078 2 года назад +2

      Bro it is not complete binaray tree

    • @smokersmoker2529
      @smokersmoker2529 Год назад +1

      finally i found answer in comment section tq.......😇

    • @a.m.4154
      @a.m.4154 Год назад +2

      If you're following the DSA textbook by Goodrich, Goldwasser, and Tamassia, the violated property is also called the depth property ('ALL nodes with zero or one children have the same black depth whereby a black node counts as it's own ancestor') which is violated by node with key 15.

    • @nonstopcodingcodewithadity8238
      @nonstopcodingcodewithadity8238 Год назад

      tho kare kya fir ? @@a.m.4154

  • @muhammadmuneeb1125
    @muhammadmuneeb1125 5 лет назад +7

    Thanks a lot
    Mam, I am from Pakistan you are too much hard-working lady.
    May Allah bless you with your dreams
    Again Thanks a lot mam

  • @gabriellaryanie7342
    @gabriellaryanie7342 4 года назад +19

    I really love your videos since I have just started 2nd semester and is starting to learn data structure. Your videos have helped me finish my homework, recommended!

  • @Burak-cr6um
    @Burak-cr6um Год назад +6

    I really appreciate this explanation, it's been super helpful. I was having a hard time, but now things make much more sense. Thanks a lot!

  • @patils22
    @patils22 4 года назад +272

    Hello mam, The BST is not a Red - Black Tree, since the path 10 - 15 - Nil has only 1 black node, whereas all other paths have 2 black nodes.

    • @TheAbsoluteSir
      @TheAbsoluteSir 3 года назад

      Can you give me a timestamp for the tree you are referencing?

    • @onkarhalder4660
      @onkarhalder4660 3 года назад

      @@TheAbsoluteSir 32.47

    • @AkhilPulidindi
      @AkhilPulidindi 3 года назад +8

      @@TheAbsoluteSir mam asked the question whether the tree is red black tree or not. She said to type answer in comments at 32:40

    • @aydendarian1785
      @aydendarian1785 3 года назад +2

      i know Im asking the wrong place but does anyone know of a way to get back into an Instagram account??
      I was stupid forgot the login password. I would appreciate any help you can offer me

    • @sofiaabbasi2404
      @sofiaabbasi2404 3 года назад +1

      @@aydendarian1785 change password

  • @crickeditzz
    @crickeditzz 8 месяцев назад +5

    00:02 Red black tree is a balanced binary search tree
    02:22 Binary search trees follow the property of left subtree having values less than the node and the right subtree containing values greater than the node.
    07:39 Red Black trees ensure balanced trees with fewer rotations
    10:09 Red black trees offer efficient time complexity for search, insertion, and deletion operations.
    15:20 Red Black trees have specific rules for node colors and relationships
    17:54 Red Black tree should have equal black nodes on all paths
    22:41 Root should be black in a red-black tree
    25:01 Red black trees are perfect binary trees with additional properties
    29:24 Red Black tree property: longest path from root is no more than twice the length of the shortest path.
    32:02 Red Black tree insertion logic

  • @vjayasinghe8695
    @vjayasinghe8695 3 года назад +2

    thankyou so many more.. i searched lots of videos about red black trees.. but i couldn't find any of video to touch my brain..this is the only one..thankyou so much.😍😘

  • @studyonline3236
    @studyonline3236 2 года назад +24

    lecture starts at 8:21 and 11:50

  • @a_sunshine_21
    @a_sunshine_21 4 года назад +7

    One of the best explained contents. Not only datastructre ,each and every video of urs. Best out of all. ❤

  • @poojatiwari7043
    @poojatiwari7043 5 лет назад +23

    Last property is being violated. ...thank u so much mam for this lecture

  • @Nitishkumar-rd4jq
    @Nitishkumar-rd4jq 4 года назад +1

    India needs these kind of people for educating other's for free of cost

  • @Amira20234
    @Amira20234 5 лет назад +19

    Really Great Lecture.. Not found this much information any where,, Many thanks from Germany

  • @saaagararts
    @saaagararts 5 лет назад +91

    32:45 It os *NOT* Red-Black tree. Because it is voilation property of every path has same Black Nodes. (At node 15 path is having only 1 Red Tree).

    • @satya8411
      @satya8411 4 года назад +30

      Shortcut:
      If a red node exists it shouldn't have a single child
      It should always have 0 children or 2 children

    • @ashu7pathak
      @ashu7pathak 4 года назад +1

      @@satya8411 I agree!

    • @sagar104gurgaon
      @sagar104gurgaon 4 года назад +4

      www.geeksforgeeks.org/red-black-tree-set-1-introduction-2/
      please go thru it.

    • @chinmaywalinjkar7340
      @chinmaywalinjkar7340 3 года назад

      this is the wrong answer
      pls don't misguide

    • @mrwlf4840
      @mrwlf4840 3 года назад

      @Satya

  • @jacksentalksjst7014
    @jacksentalksjst7014 2 года назад +2

    as i am studying in germany here i found first video to clear all my doubts. thankyou so much mam.

  • @vaibhavgarg4267
    @vaibhavgarg4267 5 лет назад +13

    Great Explanation. You make complex topics easier. Awesome way of teaching :)

  • @ashu7pathak
    @ashu7pathak 4 года назад +17

    14:06 - Head of family, like grand parents do yoga and always remain calm. Therefore, root's always black :D

  • @amritpalsingh7262
    @amritpalsingh7262 5 лет назад +13

    Thank you very much mam, i was waiting for this lecture especially from u n finally it's here.
    And getting to ur question, this not a RB tree, bcoz it's violating the last condition i.e. the no. of black trees are not same.

  • @Priya_happyface
    @Priya_happyface 5 лет назад +33

    Aap bahut acha insaan ho
    Aise hi hmari help krti rehna mam
    Phir jab job mil jayega to aapse Milne aaungi

  • @andrew2jaramillo
    @andrew2jaramillo 4 года назад +1

    I don't understand how ppl can give her a negative review. This is so good!!

  • @simple_hiddencomputer_tric9579
    @simple_hiddencomputer_tric9579 3 года назад +1

    Beauty and wisdom in one person ..bravo!

    • @newsanalysis4831
      @newsanalysis4831 2 года назад

      ruclips.net/video/4hB6-a8F9Yw/видео.html

  • @jithunniks
    @jithunniks 6 месяцев назад

    You really have an exceptional ability to explain.

  • @dineshbs6635
    @dineshbs6635 3 года назад +8

    Insertion in AVL tree takes a maximum of 2 rotations. Deletion can many rotations. Hence, Red Black trees are used if insertion & deletion operations are very frequent

  • @raginirajpoot2711
    @raginirajpoot2711 3 года назад +6

    Thanks a lot Ma'am. You are amazing 🤩🤩🤩
    Just Because of you I understood Data Structure last year ....
    And now finally I found your videos about DAA... 😁😁

    • @ayushpaine5650
      @ayushpaine5650 2 года назад

      Abe pucha kisne

    • @raginirajpoot2711
      @raginirajpoot2711 2 года назад

      @@ayushpaine5650 saaale teri esi ki tesi........kyu bhonk rha he be.......mirgi ke dore to na pd rhe tereko.....saale chle aave muh uthake .,..🤬🤬🤬😡😡😡😡

  • @susml767
    @susml767 6 месяцев назад

    You are unique!! Excellent and to the point!!

  • @vishnu88-o1x
    @vishnu88-o1x Год назад

    After watching your videos definately I am big fan of you.thanks for your teaching

  • @larsson4488
    @larsson4488 9 месяцев назад

    This is top notch teaching!! Many thanks

  • @AbhishekSingh-sy9ze
    @AbhishekSingh-sy9ze 5 лет назад +2

    I was unable to explain this topic in Geeks for Geeks interview, although I am good at competitive programming. But you explanation is quite good.
    I knew the concept already but now I can explain it to anyone. Thanks a lot ! (I wish you were my teacher, so pretty) .

  • @toetoeag
    @toetoeag 3 месяца назад

    You have explained very clearly.

  • @0neAboveAll
    @0neAboveAll 2 года назад +1

    I should pay my tution fees to you instead of my college. U are a great teacher Mam.

  • @mbm662
    @mbm662 Год назад +3

    Thank you ma'am for the best explanation ❤ . Yours teaching classes are very helpful for engineering students 🙏

  • @a-064ramakantchhangani4
    @a-064ramakantchhangani4 3 года назад +98

    The node with value 15 has no left child and total number of black nodes to the path 15 -> NIL is 0 while to the path 15 -> 25 -> 20 -> NIL is 1 and such further paths . So , not a red black tree.

    • @mrThundergodpro
      @mrThundergodpro 3 года назад +3

      Bro we know nil node also a black node so we count that node so it is red black tree

    • @qazidawood995
      @qazidawood995 3 года назад +5

      @@mrThundergodpro nill is a black bit that is one extra for each... I think ta makant has a valid point.. Its not a rbt

    • @shaankhaan1686
      @shaankhaan1686 3 года назад +6

      @@mrThundergodpro yes but if this u consider than every path has one nil leaf so then total no of black in each path is not same bro😀

    • @vasusuryavamsham4882
      @vasusuryavamsham4882 3 года назад

      15 has another left nil node which makes a path from 10 with only 2 black nodes so it is not red black tree

    • @utkarshsingh5084
      @utkarshsingh5084 2 года назад +1

      Sir aap idhar 🦧🦧🦧

  • @shubhamaggarwal4676
    @shubhamaggarwal4676 3 года назад +3

    Awesome teaching and great explanation ❤️❤️

  • @abhisheksiwach1406
    @abhisheksiwach1406 6 месяцев назад

    Thanks a lot for all the efforts !

  • @hamzaanwar7204
    @hamzaanwar7204 2 года назад

    Ma'am the way of ur teaching is just mindblowing😇

  • @americantech4151
    @americantech4151 Год назад

    Great Explanation. I learnt a lot,Thanks you so much Mam....from srilanka❤

  • @nirmalrajpurohit2728
    @nirmalrajpurohit2728 8 месяцев назад

    Quality teaching !

  • @SandeepKumar-lh7ge
    @SandeepKumar-lh7ge 5 лет назад +6

    Waiting for this...
    Thanks you so much Mam😊😊
    Keep it up 🤗

    • @JennyslecturesCSIT
      @JennyslecturesCSIT  5 лет назад +3

      yup... will upload insertion and deletion on tomorrow and day after tomorrow

  • @Laloloop
    @Laloloop 4 года назад +1

    I feel like an expert in red-black trees now haha, and I’ve never read anything for more than 2 mins about it.
    So, the last example is not a red-black tree, because in the right side you have a path to a nil with only one black node, and the others have 2 black nodes.
    Still a little bit confused on usages, although the properties of self balancing are pretty cool, I guess that’s what the red or black abstraction is for.
    Thank you! Keep up the good work!

    • @chocolaty_gurl
      @chocolaty_gurl 3 года назад

      No bro in right side also 2 B nodes one is root that is always black

  • @Badwolff.
    @Badwolff. 4 года назад +1

    Your video s is mind blowing

  • @Milind.x
    @Milind.x 5 лет назад +1

    your teaching made it easier to understand the concept..... thank u for such videos......

  • @shahdmohammed9514
    @shahdmohammed9514 Год назад

    you are perfect !! thanks for bieng this professional

  • @stasbakalo6264
    @stasbakalo6264 2 года назад +1

    Wow, that is very clarifying explanation, thank you!

  • @stephenhowe4107
    @stephenhowe4107 4 года назад +8

    20:53: Jenny introduces a 12 node to black path count is 2. But without introducing a node, make 15 black, 20 red. It becomes a red-black tree and all paths have a black path count of 2.

  • @nigarsultana1739
    @nigarsultana1739 4 года назад +1

    Definitely a great lecture mam. I am very beginner but I understood your videos completely. Thank you so much mam.

  • @vakhariyajay2224
    @vakhariyajay2224 2 года назад +1

    Thank you very much. You are a genius. 👍👍🙏🙏👌👌🔝🔝

  • @arusanoor6594
    @arusanoor6594 4 года назад

    i love ur teaching method

  • @vigneshd6887
    @vigneshd6887 3 года назад

    Well explained.👏👏👏👏👏👏

  • @mahendrasahani9148
    @mahendrasahani9148 Год назад

    good teaching methodology...thankq madam

  • @sujathaganesna9604
    @sujathaganesna9604 3 года назад +5

    I am listening to my online classes from 1week on topic red black tree...but this 30 min video helped a lot to understand....tq so much mam ...❤️

  • @khushbuverma8972
    @khushbuverma8972 2 года назад

    Maam you are a good teacher

  • @willturner3440
    @willturner3440 4 года назад +14

    Mam my friend watched you in dtu, are u teaching there

  • @princekumar-ot1ul
    @princekumar-ot1ul 2 года назад +13

    In last example(at 32:50)........It is not a RB tree.....violating last property(at node 15)

  • @ericfricke4512
    @ericfricke4512 3 года назад +1

    Very thorough and clear, thanks.

  • @upsccivilspreparation3141
    @upsccivilspreparation3141 2 года назад

    Really I love you ma'am.. you are awesome

  • @rushabhjain1962
    @rushabhjain1962 4 года назад

    Mam just love you and you knowledge 😘😘😘😘😘

  • @chetnawadhwa4345
    @chetnawadhwa4345 2 года назад

    Very knowledgeable and understanding video

  • @shaswatdasgupta3776
    @shaswatdasgupta3776 5 лет назад +10

    Hi
    All my life I feared datasturcture until I came across your channel. Thank you so much.
    About the question definitely its not a red black tree because, the no of black nodes from the root to leaf nodes is not constant. From left if I consider nil then the no of black nodes are 3, but the right sub tree it's 2 (If a black node is consider after 15 (Red).Did I get it right?
    👍 from Bangalore

    • @LochanSaroy
      @LochanSaroy 2 года назад

      Bro isn't this tree voilenting the 4 the property that is ''Every leaf which is nil should be black'''.

  • @LearnwithAJAYSAI
    @LearnwithAJAYSAI 2 года назад

    Great work mam

  • @k.mahesh7084
    @k.mahesh7084 2 года назад

    U and ur explainantion is very beautiful

  • @LakshmikanthkSICS
    @LakshmikanthkSICS 4 года назад

    Mam ur teaching is assum mam
    I think ur teaching more helpful for students

  • @sirishagolla9631
    @sirishagolla9631 3 года назад

    Iam not understand English properly but your speaking iam easily understood you have awesome English skills mam ❤️

  • @sriramamara5100
    @sriramamara5100 5 лет назад +1

    Mam love you .. excellent teaching

  • @rajesharumugam1534
    @rajesharumugam1534 3 года назад +2

    Hi Mam, @22:52 this is actually a BST. It didn't violate BST condition, instead it violated the condition "root node can't be red"

  • @saaagararts
    @saaagararts 5 лет назад +4

    Take your notes at 32:48 (rules for Red-Black trees)

  • @zenith355
    @zenith355 5 лет назад +42

    The last tree is not Red Black because the path from root node 10 to node 15 (which has left node null) contains only one Black node whereas every other path has two black.
    Correct....?

    • @ashimsingh2338
      @ashimsingh2338 5 лет назад

      Yeppp !

    • @bunnyrabits
      @bunnyrabits 5 лет назад +1

      No bro check again
      It is reb black tree

    • @hemanthsunny6555
      @hemanthsunny6555 5 лет назад +1

      @@bunnyrabits it's not a red black tree..see carefully

    • @guruprasad280
      @guruprasad280 5 лет назад

      It is red black tree

    • @harshitraj8409
      @harshitraj8409 5 лет назад +6

      @@guruprasad280 In right Subtree, Check for Node 15 having Nil on left. Hence there will be only one Black to that Nil path. But other paths have 2 Black nodes.
      So It will not be Red Black Tree

  • @ValhaVaiyagam
    @ValhaVaiyagam 2 года назад

    Awesome sister; thank you ;

  • @mohit7875
    @mohit7875 5 лет назад

    The process of teaching is very well and I am very thankful to you

  • @tushargupta2009
    @tushargupta2009 5 лет назад +1

    most awaited topic, thnku mam

  • @MuhammadUsama-zf3iu
    @MuhammadUsama-zf3iu 4 года назад +1

    Awesome Video, Thanks for Sharing, It always amazing to learn from beauty with the mind.

  • @hitlerkumari1912
    @hitlerkumari1912 4 года назад +1

    Best explanation .. thanks a lot mam...❤️❤️

  • @vgreddysaragada
    @vgreddysaragada Год назад

    very good explanation.. Thank you so much

  • @jenishdholariya6224
    @jenishdholariya6224 5 лет назад +1

    I am waiting for that video thank you so much mam you are helping us very much .. . 👩‍🏫

  • @Binks135
    @Binks135 Месяц назад

    00:02 Red black tree is a balanced binary search tree
    02:22 Binary search trees follow the property of left subtree having values less than the node and the right subtree containing values greater than the node.
    07:39 Red Black trees ensure balanced trees with fewer rotations
    10:09 Red black trees offer efficient time complexity for search, insertion, and deletion operations.
    15:20 Red Black trees have specific rules for node colors and relationships
    17:54 Red Black tree should have equal black nodes on all paths
    22:41 Root should be black in a red-black tree
    25:01 Red black trees are perfect binary trees with additional properties
    29:24 Red Black tree property: longest path from root is no more than twice the length of the shortest path.
    32:02 Red Black tree insertion logic
    Crafted by Merlin AI.

  • @jithinmv6516
    @jithinmv6516 5 лет назад +12

    The last question you left for us
    It is not a RB Tree, Coz in the right subtree on one path we have only one black, Am I right..?

  • @saichand1948
    @saichand1948 5 лет назад +1

    Thanks for free class

  • @susenakodumuri2667
    @susenakodumuri2667 4 года назад

    Really love you mam.... Awesome explanation ❤️

  • @b_01_aditidonode43
    @b_01_aditidonode43 Год назад

    thanks mam crystal clear explaination

  • @arpitajain5903
    @arpitajain5903 4 года назад +2

    Ma'am to be honest... Ur lecture is as awesome as u r.... #beauty with brain :)
    Bcoz of ur knowledgeable videos my most of the concept related to data structure has got cleared.. Hats off to u ma'am ... Thnkyou so much ma'am for this precious E-lectures

  • @ushavarma1138
    @ushavarma1138 3 года назад

    really your lectures amazing ,thank u .....

  • @DaudKhan1
    @DaudKhan1 3 года назад

    Useful video for me ..thanx mam

  • @anjalikhatri1962
    @anjalikhatri1962 4 года назад +4

    Thank you mam for doing such a great work❤

    • @Badwolff.
      @Badwolff. 4 года назад

      Hi she is the best teacher

  • @armandoantoniogarduno4969
    @armandoantoniogarduno4969 2 года назад

    Thanks for sharing, the RB Trees looks clearer now.

  • @Sauravgpt34
    @Sauravgpt34 5 лет назад +1

    bohot pyara padhati ho aap :*

  • @fallinlovewithcars
    @fallinlovewithcars 3 года назад +1

    Thanku sooooo much ma'am for these lecture.
    These lecture help a lot for our university exams

  • @pradeepmeena5463
    @pradeepmeena5463 2 года назад

    thank you so much mam for this lecture❣❣

  • @sahilgaikwad2002
    @sahilgaikwad2002 3 года назад +5

    Mam you are amazing I have lot confusion about red black tree. After watching this video that confusion is gone 😃 thank you mam🙏❤️😊

  • @neelmanikumar6765
    @neelmanikumar6765 5 лет назад +7

    Thank You, ma'am, for such a beautiful explanation ...

  • @sakthij7003
    @sakthij7003 2 года назад +3

    I like that she wrote Black in black marker

  • @Amine-gz7gq
    @Amine-gz7gq 3 года назад

    Very clear ! Thank you, I can sleep less ignorant about this topic. C++ STL's std::map is a RB-tree.

  • @techfocusplus
    @techfocusplus 4 года назад +6

    Hello Jenny, thumbs up for the well explained lesson, can you please make a video of all the Balanced BSTs together, maybe like a summarized video. Thanks.

  • @lawbindpandey402
    @lawbindpandey402 4 года назад +1

    Skip to 11:50 ..where introduction to red black tree starts .....and before it I.e from 0:0 to 11:50 it's just revision of BST and AVL TREE!!!

  • @SaileeShingare
    @SaileeShingare 4 года назад +6

    Thank you making me understand the concept of red- black tree clearly, needed this in lockdown ☺️

    • @ayushpaine5650
      @ayushpaine5650 2 года назад

      Randike lockdown Main kya karra tha tu