1382, 108 Balance a Binary Search Tree | Day-Stout-Warren (DSW) Algorithm | In-Place Balancing

Sdílet
Vložit
  • čas přidán 20. 07. 2024
  • In this video, I'll talk about how to solve Leetcode 1382. Balance a Binary Search Tree | Day-Stout-Warren Algorithm | In-Place Balancing | Inorder | Greedy | 108. Convert Sorted Array to Binary Search Tree
    Tree Traversals + Morris Traversal - • 94. Binary Tree Inorde...
    Let's Connect:
    📱Discord (Join Community) : / discord
    📝Linkedin: / aryan-mittal-0077
    📸 Instagram: / codewitharyanbhai
    💻 Twitter - / aryan_mittal007
    🤖 Github: github.com/aryan-0077
    About Me:
    I am Aryan Mittal - A Software Engineer in Goldman Sachs, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)
    ✨ Timelines✨
    0:00 - Bakwas
    0:21 - Problem Explanation
    3:24 - Leetcode 108. Convert Sorted Array to Binary Search Tree
    7:18 - Inorder Traversal & Code Explanation
    10:59 - DSW Algorithm
    15:12 - Right & Left Rotation
    20:04 - Convert BST to Backbone/Vine
    25:18 - Convert BackBone to Complete Binary Tree
    34:28 - Code Explanation Combined
    ✨ Hashtags ✨
    #programming #Interviews #leetcode #faang #maang #datastructures #algorithms

Komentáře • 29

  • @user-ip9kr9nz9t
    @user-ip9kr9nz9t Před 25 dny +15

    The level motivation this guy has is astounding

    • @princenagar1686
      @princenagar1686 Před 23 dny +1

      This is not astonishing, it's his hard work and consistency. There are actually thousands of people who are doing it right now excluding you. That's why you think it's too much, people actually work real hard and rest just imagine how are they working so hard

    • @user-ip9kr9nz9t
      @user-ip9kr9nz9t Před 20 dny

      I am sorry but do I know you ? Don’t blabber about someone you don’t know. Appreciating something is not equivalent to lacking unlike you of course who cannot even comprehend appreciation. Anyways what’s best for you da

  • @satwiktatikonda764
    @satwiktatikonda764 Před 25 dny +9

    how are you this much consistent bro😱😱

    • @princenagar1686
      @princenagar1686 Před 23 dny

      This is not too much, it's normal if you are actually a serious coder

  • @vaxxnsh
    @vaxxnsh Před 24 dny +3

    Maksad pura ho gya 👍

  • @parthbhalerao3669
    @parthbhalerao3669 Před 24 dny

    The level of effort he is putting into explaining is totally amazing.
    You are the best bro !!

  • @AmanKumar-cc9ui
    @AmanKumar-cc9ui Před 24 dny +1

    Guys Skewd Case at @1:55 By Mistake Aryan mentioned the TC in worst case would be log(n) it should be O(n).

  • @Munchen888
    @Munchen888 Před 24 dny +2

    Some hints 😊:
    1. gather into list
    2. use partition to divide on equal parts

  • @youcanyouwill2004
    @youcanyouwill2004 Před 8 dny

    Amazing explanation !! Thanks a lot ❤❤❤❤❤❤

  • @6mahine_mein_google
    @6mahine_mein_google Před 24 dny

    @18:47 in the example u took in the code it should be parent->left = temp , and this code works in the final code beacuse we are doing left rotations only in the right subtrees of the skewed vinetree .

  • @UNKNOWN-zm1jr
    @UNKNOWN-zm1jr Před 24 dny

    Just amazing bro

  • @rhydhamsingla9597
    @rhydhamsingla9597 Před 25 dny +1

    very nice explanation. I appreciate your efforts brother.
    I also have an ques, in the video you said that we "assume" that this is gonna give us a perfect tree, so i wanna know that does this algorithm have a fail or that was your way of teaching?

  • @PulkitAgg13
    @PulkitAgg13 Před 24 dny +1

    Have they asked AVL Tree by using confusing language?

  • @dhaanaanjaay
    @dhaanaanjaay Před 24 dny +1

    You and neetcode both rock🤟🤟🤟

  • @deepakchalla495
    @deepakchalla495 Před 24 dny

    I saw the problem and the first thought i got was AVL trees but i found it difficult in implementation. This method is easier than that.

  • @codebreaker6578
    @codebreaker6578 Před 24 dny +2

    please explain when i am taking vector arr for storing the values in sorted order , and then making tree from the arr is taking 762ms while vector arr is talking 62ms .
    why the time is differed this much ?

    • @btechstudent1620
      @btechstudent1620 Před 24 dny +1

      just dont care abt the time that leetcode , even u run the same code at a very different time then always u will see huge variation in the time

    • @codebreaker6578
      @codebreaker6578 Před 24 dny

      @@btechstudent1620 i know that thing but that's a huge difference and also he mentioned to use TreeNode

    • @arnavkaul7827
      @arnavkaul7827 Před 24 dny +1

      That is irrelevant to a certain extent it has something to do with the server as well don't focus on the time taken rather how many edge cases you can pass

  • @mohammedansil2302
    @mohammedansil2302 Před 23 dny

    great video

  • @theUnkown617
    @theUnkown617 Před 24 dny

    You said there is no recursive extra space used but in the editorial they mentioned that there will be O(N) extra space for recursive stack could you clarify that ?

  • @princenagar1686
    @princenagar1686 Před 23 dny +3

    Bro , i have one suggestion for you. The only problem that you have is "Your Over Explaining Things at incorrect moments". This thing just make your simplification real hard. I suggest you to explain what's necessary for that "moment" to understand.

  • @shahzodshafizod
    @shahzodshafizod Před 25 dny +1

    Simpil bro, simpil)

  • @aerinpatel8467
    @aerinpatel8467 Před 24 dny

    Hard to Move On 👀

  • @prathmeshsananse7064
    @prathmeshsananse7064 Před 20 dny

    Amazing work man, keep it coming