5.19 Splay Tree Introduction | Data structure & Algorithm

Поделиться
HTML-код
  • Опубликовано: 27 дек 2024
  • Correction: at14:21 9 will be left child of 10
    Jennys Lectures DSA with Java Course Enrollment link: www.jennyslect...
    DSA Complete Course: https: • Data Structures and Al...
    In this lecture I have discussed basics of Splay tree, rotations used in splay tree, advantages and drawbacks of splay tree, applications of splay tree.
    See Complete Playlists:
    C Programming Course: • Programming in C
    C++ Programming: • C++ Complete Course
    Python Full Course: • Python - Basic to Advance
    Printing Pattern in C: • Printing Pattern Progr...
    DAA Course: • Design and Analysis of...
    Placement Series: • Placements Series
    Dynamic Programming: • Dynamic Programming
    Operating Systems: // • Operating Systems
    DBMS: • DBMS (Database Managem...
    Connect & Contact Me:
    My Hindi Channel: / @jennyslectureshindi
    Facebook: / jennys-lectures-csit-n...
    Quora: www.quora.com/...
    Instagram: / jayantikhatrilamba

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

  • @JennyslecturesCSIT
    @JennyslecturesCSIT  2 года назад +92

    Correction: at14:21 9 will be left child of 10

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

    Splay tree is the topic which you will hardly find on youtube. Thank you mam for explaining this topic so perfectly on demand.

  • @pradnyakharade3718
    @pradnyakharade3718 3 года назад +58

    Correction - 14:20 that 9 shd be to the left of 10 and not to left of 7

  • @huseyinkadioglu
    @huseyinkadioglu 5 лет назад +35

    someone already mentioned it but im gonna right it anyway for anyone didnt see that comment , 14:20 9 is gonna be the left child of 10... and Jenny thanks.. getting use to the accent btw.

  • @indumahaseth116
    @indumahaseth116 3 года назад +39

    Node(14) will take 3 rotation. At first,it will take left rotation (zag) and will be placed where node 13 is then it will take right rotation (zig) to take place of node 15 and then at last it will take left rotation (zag) to take place of node 10 and therefore by this way it will become root node.

    • @ishankmoraiya5351
      @ishankmoraiya5351 Год назад +7

      so it become zag-zig-zag rotation ..it is true?????????

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

      what if I suppose the left rotation as ' zig ' ?

  • @prithviraghavan1180
    @prithviraghavan1180 5 лет назад +39

    I get to confused with your zig and zag pronunciation but concept wise its really good !

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

      Yeah bro!totally confused😆

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

      @@saicharan6514 haryanvi accent :)

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

      puchi kisi ne - yashraj mukhaute

  • @pratik6089
    @pratik6089 3 года назад +15

    28:20 -Zag-zig rotation and then Zag rotation
    3 rotations applied

  • @CaptainDeadpool53
    @CaptainDeadpool53 2 года назад +5

    Really appreciate these lectures here, helping me in the last moment rush to study things when the notes don't explain anything conviniently

  • @lakshmitulasi4642
    @lakshmitulasi4642 Год назад +4

    First zag then zig zag mam to search the value of 14 . Mam do correct me if am wrong .
    This is the answer for question asked @ 28:18
    Really mam its helping a lot till now ....its like literally 4years since this playlists has been uploaded , we dont have any fikar about ds ka subject. Thats the power of a quality teacher ! Take a bow!! Thank you mam !

  • @ankitsajwan4239
    @ankitsajwan4239 5 лет назад +11

    awesome explanation ... thanx a lot, your all videos are helping me prepare for my upcoming exams... god bless you

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

    In case of zig-zig or zag-zag rotation we are first rotating grandparent and then parent but in case of zig-zag or zag-zig you are rotating first parent and then grandparent. A little bit confusing

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

      yes that's rule about rotation.. u need to take care of this thing while splaying

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

      @@JennyslecturesCSIT okay mam got it✌️☺️

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

    I am lazy, I just like videos to support who made them. But this video is THE VIDEO on RB trees. I saw it fully with adv and repeatedly. I pray you should feel satisfied and fulfilled in all your life.

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

    I love your teaching mam🥰 i think am fall in love in your teaching❤

  • @pruthvi491
    @pruthvi491 5 лет назад +27

    to search 14 we need 3 rotation zag - zig - zag in splaying.

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

      No need

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

      for last question ‐---》
      *s1 : * zig rotation of 15 so 13 is new parent and 14 attaches to 15 on left side
      *s2 : * zag rotation of 10 so 13 is new root and 11 attaches to 10 on right side
      *s3 : * zig rotation of 15 so 14 is new parent
      *s4 : * zag rotation of 13 so 14 is new root
      right?

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

    hello mam , your way of explanation is very cooll,,and one of my friend named avi goyal is also your great fan

  • @pinakranjandas5770
    @pinakranjandas5770 3 года назад +4

    2 ROTATIONS
    1>ZAG-ZIG((zag part)14 will come to the 13 place and 13 will go left to the 14 after that (zig part)14 will go to the 15 place and 15 will go right of 14)
    2>ZAG (14 will go to the root place and root 10 will shift left of 14)

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

      for last question ‐---》
      *s1 : * zig rotation of 15 so 13 is new parent and 14 attaches to 15 on left side
      *s2 : * zag rotation of 10 so 13 is new root and 11 attaches to 10 on right side
      *s3 : * zig rotation of 15 so 14 is new parent
      *s4 : * zag rotation of 13 so 14 is new root
      right?

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

      can I consider the left rotation as " zig " and right rotation as " zag " ?

    • @PiyaliKarmakar-z5n
      @PiyaliKarmakar-z5n Год назад

      sure but your teacher may not consider that, so when they puts a 0 in your answer script, consider it to be a 10 @@atharvakunde8616

  • @himanshu7916
    @himanshu7916 Год назад +5

    I have never seen such kind of teacher, teaching as perfect as you are!!! We Are really Very Glad😊 To Have youu Mam🤌❤️ Such an extraordinary concepts you have built yourself, really great mam hats off to you 🙌🫶✨

  • @Neoworld-v3y
    @Neoworld-v3y 8 месяцев назад

    ma'm i really appriciate your study videos. they are very useful for my studies. thanks alot from sri lanka😘😘

  • @AlishaAli-jr2ob
    @AlishaAli-jr2ob 8 месяцев назад +1

    i didn't find code implementation of trees in cpp, i love your videos way of teaching kindly pls make videos of implementation

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

    Hi ma'am, I have a doubt, at 14:20, the tree on the left states that 7 becomes the root for 9 and 10, but then why is 9 on the left of 7, shouldn't it be on the right side of 7? Or we can have 9 instead of 7, 7 on the left and 10 on the right?

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

    Very nice delevering technique to student . Watching from surkhet nepal.

  • @01-a-mohitjain80
    @01-a-mohitjain80 2 года назад +1

    mam 2 rotations will be needed for 14 that is zag-zig then just zag

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

    at the very first instance ,your beauty n now your hard work is compelling me to fall for you..😊😊

  • @inspiringbeing3230
    @inspiringbeing3230 5 лет назад +8

    Maam DBMS series will be uploaded and completed before 24?!?!
    Was about to start tuesday nA

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

    15:01 result of zig zig rotation is not following BST property, 9 is greater than 7 so it should be in a right of 7.

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

    for last question ‐---》
    *s1 : * zig rotation of 15 so 13 is new parent and 14 attaches to 15 on left side
    *s2 : * zag rotation of 10 so 13 is new root and 11 attaches to 10 on right side
    *s3 : * zig rotation of 15 so 14 is new parent
    *s4 : * zag rotation of 13 so 14 is new root
    right?

  • @jeanw4287
    @jeanw4287 24 дня назад

    god-tier explanation!

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

    Sooooo helpful, you saved me today, ma'am🥰

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

    in The zig-zig rotation on the final tree, as we know after splaying the tree must be BST(i.e left child of anode is less than the root node and right child is greater than the root), but when we look the result of the tree after splaying(1) it is not BST( i.e when we look node 7 its left child is greater than (9>7)) why?????

  • @prithviraj-x7d
    @prithviraj-x7d Год назад

    From a main tree if i want to search -1 what is the procedure to be followed? which type of rotation it would be!?

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

    Hi Jenny, Cud u review this and clarify/confirm/correct?
    Suppose a and b to the left and right extreme of splay tree are the most frequently accessed. search(a) zigs, makes a root, and pushes b down by almost double height. And search(b) next zags, make b root, and pushes a double the height down (when compared with the original tree height). So, every time these 2 searches happen consecutively, multiple rotations and too much skewing of the tree would occur, and search would be O(logN) and never O(1)
    How about use Treap instead of Splay Tree to achieve the same?
    The splay tree keys become Treap keys. Keys satisfy BST rule. Number of searches for a key becomes the node's priority. Priorities satisfy max-heap rule. Hence all those keys that are most frequently searched would always be very close to the Treap root, and skewing would also be relatively lesser.
    And, above case of search(a) and search(b) happening consecutively, and many times, would ensure that a and b stay very close to Treap's root (if not become the root) due to tremendous increase in their priorities. The extreme zig or zag as with Splay Tree wouldn't happen here.
    Is there any mistake in my understanding? Please comment on this. Thankyou! :)

  • @teetanrobotics5363
    @teetanrobotics5363 5 лет назад +5

    Just Amazing as usual

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

    Merci tu as sauvé mon examen d'algo !

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

    This video will be most useful for me before exam .. thanks a lot

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

    Your lecture on splay trees are very superb...👏👏👏

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

    mam don't you think that you should also provide the code for better understanding?

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

    16:48 -> right-side if you want to search 30; we will perform 4 zig rotations i.e. zig zig zig zig rotation....

    • @Rauhan-fb1tz
      @Rauhan-fb1tz 2 месяца назад

      @@prabhassla4237
      No brother we will do 3 Zig Zig rotations

    • @Rauhan-fb1tz
      @Rauhan-fb1tz 2 месяца назад

      No...bro we will do 3 Zig Zig rotations

  • @UMERFAROOQ-cl2nd
    @UMERFAROOQ-cl2nd Год назад

    At 14:32 the Child of 10 should be 9 and 15 but you write child of 7 as 9 and 10 ,as we can see 7 is smaller than 9 so 9 cannot be in its left side i think so please let me know this ?

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

    mam what about the case in which grandparent of the node (to be searched) is not the root? like searching 14 in the last example , if we perform any rotation in case3 like (zig-zig ,zag-zag, zig-zag, zag-zig) then 14 would not be at the root , it would 1 level below the root? is that correct?

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

    mam...i saw the same tree you told told that parent of the searched node has to roatated untill the root is obtained....in java point website they tod to rotate the grand parent of the node untill the searched nodde is root...which is right mam??can u repost a new version of this vedio reclarifying it??

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

    Time (15:09) After performing the second zig rotation the 9 will at the left of 10 not the left of 7.

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

    in zig zig how can 9 be the left child of 7
    splay trees also follows the bst right?

  • @kritiraghuvanshi3309
    @kritiraghuvanshi3309 5 лет назад +2

    Ma'am pplzz add videos for B-tree.
    It's really an important topic for our university exam.
    And I my only source of learning is u.

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

      Already uploaded dear. Check out the playlist "b tree and b+ tree"

  • @shyamprakashm6325
    @shyamprakashm6325 5 лет назад +2

    Mmm expected video from my side ...thanks 😍

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

    Hello, in minute 16:00 the 13 in the ZAG seems wrongly placed in comparison to the 9 in the ZIG or viceversa.

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

    Thank you very much. You are a genius.

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

    Upload on AA tree,KD tree also if possible😄bcoz I know no one will explain it like u :)

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

    Excellent Explanations Jenny...
    God bless you !!!!!!!

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

    What is the point of splaying when we have already found the node?

  • @HarshYadav-cj3yu
    @HarshYadav-cj3yu 5 лет назад +1

    14:34 9 is left child of 7 ?🧐🤯
    how, can't understand?
    Is it mistakenly written or like that only?
    I am asking with no intent to disrespect you at all. thank you

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

      it was by mistake...9 will be left child of 10... btw thanks for highlighting this correction

    • @HarshYadav-cj3yu
      @HarshYadav-cj3yu 5 лет назад

      @@JennyslecturesCSIT thanks for replying janita ma'am

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

      @@JennyslecturesCSIT I also noted that.. Thanks for making my day on trees

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

    wow! You gave a very clear explanation madam

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

    lastly mam wrote one more feature , but unable to see, could anyone tell.

  • @blastgaming2058
    @blastgaming2058 6 месяцев назад +2

    Watching at 11:15 am when the exam is at 1:45 pm

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

    Thank you very much for helping me understand this topic!!

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

    Answer is Zig-zag-zig rotation
    Thank you memdm ji

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

    Ur energy is fierce

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

    for searching 14 can we do first zag zig rotation and then zag rotation ?

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

    Mam aapke padane ka style wahhh I like you mam

  • @sandeepxytcreations5673
    @sandeepxytcreations5673 11 месяцев назад

    There after zig zig rotation 9 is placed left to the 7 but it was greater than 7 ,9 shoud be placed right to the 7

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

    Thanks for this wonderful lecture , keep it up Jenny 👍👍 you are doing a wonderful job for all the learner’s out their .

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

    in order to insert 14 we will do three rotation

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

    Mam.. shortening the video a bit will make your videos a good reach. Best teaching 💯💯💯🔥🔥

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

    if a node have more than two parent than how many rotation need to do , mam ji ? do we need to make a node as a root node always if I am searching that particular node ?????

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

    a big thanks for your work

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

    why you don't write the code of AVL and RedBlack ?

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

    keep it up jenny...your very intelligent and cute also😍💟❣

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

    Thanks for taking my request

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

    legendary teaching!

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

    It's very clear to understand Tsm sister

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

    thanks for very clear explanation!

  • @climbeverest
    @climbeverest 4 месяца назад

    Is it log base 2 n?

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

    Awesome explanation thank you....

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

    Mam Will you please check the BST after the zig-zag rotations I think it doesn't follow.....if I'm wrong then ignore me🙂🙂

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

    Mam can you tell about skip list and xor lists

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

    15:45 at this time in the video .. after zig-zig ang zag-zag rotations....the tree in not following binary search tree I guess. .......coz the nodes are coz the parent node must be less than right child and more than left child ........after rotations

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

    Very nice explanation! But I have doubt. After every operation it splays which usually leads to loss of its balancing property, but still we says that its a self-balancing tree. WHY??

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

      I guess it's not about balance factor of AVL but a balance of BST. Balance of BST remains.

  • @AjayThakur-zb3ee
    @AjayThakur-zb3ee 5 лет назад +2

    Thanks maam today I was looking for that topic in your playlist please complete it ASAP

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

    thank You So much . Understood Prefectly .♥

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

    awsome lecture...keep going

  • @thanushaan2510
    @thanushaan2510 10 месяцев назад

    Ma'am I kindly request ,
    Please teach us about trie data structure with code implementation.

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

    Ma'am can you please upload video on Kd Tree .....

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

    actually mam at 14:56 the final splay tree you made is wrong i think because it has 9 on left of 7 not 10

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

    Thanks mam, easy to understand :)

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

    Please make a video on segment tree

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

    the most frequent one or the recent ones??
    i guess it should be recent ones

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

    Searching 14 requires a combination of three operations mam: Zag - Zig - Zag! Guess am correct! If not please let me know. Thanks for being this super excellent and precise. May Allah bless you

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

    Mam please make a video on hamilton cycle using backtracking

  • @AbhishekKumar-im2xd
    @AbhishekKumar-im2xd 5 лет назад +1

    Binary threaded tree.. Mam??

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

    super mam😘🥰😍

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

    I better than understand maim and thanks so much

  • @Secret-army6
    @Secret-army6 9 месяцев назад

    I deeply understand the process but i saw 7 is root and 9 is also greater than 7 but less than 10 ...i think 9 will child of 10 not 7...coz in BST left child should be less than and right child should be greater than root node.....

  • @nagendrababurachakonda2334
    @nagendrababurachakonda2334 5 лет назад +2

    Madam sply tree Ana split tree Ana same ha

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

    amazing explanation, thank you mam :)

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

    Mam, all your lectures are very good. In this lecture you have stated multiple times zig and zag are sometimes said in opposite way, can you please provide some reference to which books or reference you are referring to?

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

    Very systematic and clear explanation, many thanks!

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

    The node 9 goes to left child of 7. I think it is not possible. Violating the rules of BST

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

    you are too perfect teacher and also cute

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

    Well explained Mam ☺️

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

    One ZIG-ZAG rotation i.e. for nodes 15-13-14 (LR) and then one ZIG rotation i.e. for node 10 -14 (L) :*

  • @VAMSIKRISHNA-kr3qf
    @VAMSIKRISHNA-kr3qf 5 лет назад

    I think the answer for search 14 is 3 rotations zag zig zag left right left