Binary Tree to Doubly Linked List ( Inorder Based) BST to DLL

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

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

  • @nayanbhuyan8156
    @nayanbhuyan8156 3 года назад +14

    Every time I open a question and search on youtube for an explanation, the first recommendation is always of this channel
    Sir your videos are great even in 2021, keep inspiring us with amazing explanations as you always do
    I am just a random coder, Sir doesn't know me neither do I
    I just watch his videos because of the way he teaches, making you fall in love with coding
    Thank you, sir, for your time and hard work

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

    Those white board are so much need and so much forgotten in a certain university. Explanation was spot on. Many thanks

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

    Your teaching remembers me the famous quote "slow and steady win". This problem is asked in one of my faang interview

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

    No RUclipsr has teach sooo nicely and so easily the way this guy has teach. This guy made recursion so easy you are amazing ❤️ you deserve 100million likes🙌

  • @Rahul-sq6gk
    @Rahul-sq6gk 3 года назад

    this is probably the best explanation u can find on YT

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

    Mate I am totally speechless. This is so amazing. Thanks for making the concepts and algorithms looks to simple and clean. Wish you all the best. Keep posting videos :)

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

    Sir great video:) the patience with which you teach the algorithm and code is unforgettable.

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

    Wow !! What an explanations .Really amazing dry run Sir.

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

    i love this guy's innocent face

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

    Your explanations are great , plz make more series on other topics as well like recursion , backtracking

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

    Really nice explanations sir .You are my one stop solution for tree algorithms😁.

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

    very well Explained Sir!!Thanks for the intution!!

  • @RAHULGAUTAM-nu9od
    @RAHULGAUTAM-nu9od 6 лет назад +7

    Great explanation Sir, but please correct me if I am wrong, if feel second argument head should be the double pointer to hold the address of the pointer of caller of this method, so that caller method head pointer will have address of first node of doubly linkedlist, else in current case we are passing a copy of that pointer which is NULL and which has new address, so caller head is anyway not going to be updated with this.
    NOTE : this function is not returning anything, else we could have update caller's function head with return value.

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

    Its the best explanation ever....!

  • @ShreyaSingh-vr9qi
    @ShreyaSingh-vr9qi 4 года назад +1

    Awesome way of teaching, thanks you are helping a lot in my placement preparation !!

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

    I am learning tree for first time and the video helped me to cleary understand the recursion concepts in tree... Thanks a lot

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

    Damn!! Hats Off to you sir. Thankyou so much for this wonderful explanation. :)

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

    great job sir!!definitely the best explaination for the topic

  • @Mei-ir3ml
    @Mei-ir3ml 6 лет назад +1

    Just Rocked with Binary tree !!! Great bro !! You are saving many peoples life

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

    Amazing explanation, thank you so much

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

    this is amazing and detailed . Thank you

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

    Sir, won't the line "static prev=NULL" cause a trouble, as every function call will set prev to NULL ?

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

      i am having the same doubt

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

      thats why it is made static , so that it will not become NULL every time you call the function . Static variables are those variables which have only 1 copy during the entire program . every objects of a class use or access that same static variable . you can also declare Node* prev = NULL outside the function but inside the class , it will work too.

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

    Gajab sir aag lga di awesome :)

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

    great explanation sir!

  • @usamaalioffical
    @usamaalioffical 7 лет назад

    Very precisely and effectively explained Seriously Hats off to you.Bohat mza aaya lecture dekh kr.Lots of love from Pakistan

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

    You are great please upload more videos

  • @Adityasharma-oe8zp
    @Adityasharma-oe8zp 3 года назад

    He is a gem❤️

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

    great explanation sir

  • @abhi4unme2002
    @abhi4unme2002 7 лет назад

    You are awesome Man !!! Great Job. Really Liked your Videos. I wrote this code once by myself, but Now I will remember for ever after seeing your video.

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

    Amazing explanation..Great job!!!

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

    amazing.. really amazing.. u r tushar roy of Linked list and trees.

  • @yanlingyang256
    @yanlingyang256 7 лет назад +1

    Great!!!! Very concise and easy understandable explanation!!!! Thank you

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

    Actually this is a very simple problem:
    1. A linked list is a perfectly unbalanced BST.
    2. You get a perfectly unbalance binary search tree if you add sorted elements to a it.
    3. So you have to read the BST from highest to lowest or lowest to highest value, while creating a linked list.

  • @anamigator
    @anamigator 7 лет назад +4

    Thank you for the video :) Can you also discuss time and space complexities of your solutions.

    • @brandonlavigne3670
      @brandonlavigne3670 6 лет назад

      Did you not watch the video? He discusses both the time and space complexities.

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

    thank you so much sir..

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

    Great Explaination Sir

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

    thnk you soooooo much !!!!!! Your explanation is awesomeeeee

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

    Sir u are amazing

  • @user-or7ji5hv8y
    @user-or7ji5hv8y 5 лет назад

    This is a really good step by step explanation. Thank you.

  • @niko-l-
    @niko-l- 6 лет назад +2

    Thank you very much man for the detailed explanation.

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

    very nicely explained, sir.

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

    Thank you for video

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

    Sir aise hi speed maintain karke rakhna. Fir bade ache se samajh ata hai. jinko slow lagta hai Fast Forward ka option hai unke liye RUclips me.

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

    Superb Explanation sir!!

  • @karthikrajasekaran983
    @karthikrajasekaran983 6 лет назад

    Awesome way to explain a difficult topic. You have a great gift and thanks for sharing your wisdom with us.

  • @potato-gi1xr
    @potato-gi1xr 3 года назад +1

    thank you sir

  • @renusharma8677
    @renusharma8677 7 лет назад

    nice video ...every step is clearly explained

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

    Good explanation, really helpful.

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

    Great explanation. Thank you!

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

    Amazing! Thank YOU sir

  • @afeworkatnafu5113
    @afeworkatnafu5113 6 лет назад

    Very clear and nice explanation. Thank you!
    What would be the change to convert it to Circular Doubly Linked List (Instead of just to doubly Linked list)?
    How can we capture the first and last node of DLL and link them to each other using the same recursive function?

    • @afeworkatnafu5113
      @afeworkatnafu5113 6 лет назад +1

      Given globally declared CDLL head/tail pointers: cdll_head, cdll_tail; making a couple of changes in step 2 of the algorithm can capture head and tail nodes.
      _Bool flag = 0; //local declaration
      if(prev == NULL){
      head = p;
      if(flag == 0){
      cdll_head = p;
      flag = 1;
      }
      }
      //..... (rest of step2 goes hear
      cdll_tail = p; //Add this at the end of step 2
      Once the convert() is done, we can then link the two nodes on the calling function:
      cdll_head->left = cdll_tail;
      cdll_tail->right = cdll_head;

  • @isabelbertolotti9408
    @isabelbertolotti9408 6 лет назад +1

    Muy bueno, saludos desde Uruguay.

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

    nice explaination

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

    Thankyou sir! you are awesome!

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

    Thank you

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

    Thanks a lot!

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

    great work sir!!!

  • @udayakumarmuthusamy1457
    @udayakumarmuthusamy1457 7 лет назад +1

    Can you please post videos on - in/pre/post order traversals without recursion?

  • @kalpkumudkumar8163
    @kalpkumudkumar8163 6 лет назад

    what an explanation !!! bravo

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

    Very well explained.
    thanks for sharing these information.

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

    the condition prev=NULL will be wrong if we code because there will be no. of testcase. you need to check head is null or not

  • @viswanathkrishnamurthy6848
    @viswanathkrishnamurthy6848 6 лет назад +1

    Great video!. Can you post any video to convert doubly linked list to Binary tree?

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

    Hi vivekananda, can u make video for same question but in iterative way NOT recursive way

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

    ausum explanation..!!

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

    You are amazing, thank you very much!

  • @RottenWoodInPower
    @RottenWoodInPower 6 лет назад

    Very clear. thank you mate

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

    Can you do binary tree to circular doubly linked list ? If you do that it will be very helpful

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

    Excellent explanation! Thank you

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

    at 16:00 there is main concept which will remove all confusion.

  • @PavanKumar-kf1to
    @PavanKumar-kf1to 6 лет назад

    Nice article

  • @nutandevjoshi
    @nutandevjoshi 6 лет назад

    You deserve more followers! Great video. By the way was that Marathi accent? :)

  • @arjoojain9809
    @arjoojain9809 6 лет назад

    Good Explaination!

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

    Amazing✨

  • @shubhamsaurabh582
    @shubhamsaurabh582 7 лет назад

    helped in understanding the topic in no time. keep on making videos

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

    great!😇

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

    great explanation! is there a python solution for this code anywhere?

  • @md.muidulalamtuhin1863
    @md.muidulalamtuhin1863 4 года назад

    This is a great video.
    I have a Question.
    The initial structure of the Binary Tree will be lost if we follow this algo.
    Is there any way to get back the initial structure of Binary Tree?

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

      the problem requests that we change the tree in place, meaning we change the structure. So no there will be no way

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

      lol.. why would u want that , doing inplace is a better method ,,,however if u want to preserve it just do inorder traversal and store the node values in an array and then make a doubly link list for those array values.

  • @bigjforever
    @bigjforever 7 лет назад

    very nice

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

    Great explanation!!!

  • @adityaprakash9265
    @adityaprakash9265 6 лет назад

    Hi Nice watching yr video , can you please xplain DLL to BST

  • @HarshaVardhan-jf9sd
    @HarshaVardhan-jf9sd 5 лет назад

    y only inorder or BFS based traversal needs to be followed for converting a BT to DLL?

  • @deepaktiwari-zh6do
    @deepaktiwari-zh6do 5 лет назад

    can you explain fenwick Tree and segment tree ??

  • @RiteshSingh-ru1sk
    @RiteshSingh-ru1sk 4 года назад

    Great Explanation:)

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

    nice

  • @rahul49946
    @rahul49946 7 лет назад

    is there a way to give a name for the DLL first node's pointer which is null and also the DLL last node's pointer which is also null...because I want to make it circular DLL

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

    0:06 Thanos

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

    u are awesome.......awesomeawesomeawesomeawesomeawesomeawesomeawesome..

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

    I don't think there was any reason to pass around 'head' parameter in the convert function. (Or may be I am missing something)

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

      Looks like he made a mistake there.
      It should have been passed as node** head and we should have passed &head from the calling function.
      If there had been no head in the convert function, printing or accessing the doubly linked list outside the convert function would have been difficult

  • @rahul49946
    @rahul49946 7 лет назад

    or can we write head->left = prev->right after the Convert function so that it becomes Circular DLL

    • @nitishiter
      @nitishiter 7 лет назад

      head->left= prev and prev->right = head, this will make it a Circular DLL

  • @ashishsinha8893
    @ashishsinha8893 7 лет назад

    swap the node in forward directions plz make the videos of this

  • @saikumartadi8494
    @saikumartadi8494 6 лет назад

    excellently explained :) bravo !!

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

    Can You please , give a tutorial for converting BST to Circular Linke List

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

    Sir its not usefull to take prev as static. Because if we want to apply it on two bst the second one would be linked to the first one

  • @abdo-ft1pr
    @abdo-ft1pr 5 лет назад

    thinks from egypt

  • @nikhilgoyal3279
    @nikhilgoyal3279 6 лет назад

    Better than the f*****g nptel

  • @bhojpuri-short34
    @bhojpuri-short34 5 лет назад

    Thank you so much !!!!

  • @spacesuitred3839
    @spacesuitred3839 6 лет назад

    is space complexity is O(1)?

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

    8:16 ---reason y prev is static

    • @RavinderKumar-bn4ch
      @RavinderKumar-bn4ch 4 года назад

      because if it's not the value of prev will vanish when we exit recursion but instead we are using static so a prev can be maintained globally

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

    THANKS SIRR!!!

  • @srimadbhagavadgitabyvedavy2232
    @srimadbhagavadgitabyvedavy2232 6 лет назад

    You are doing awesome job :)