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

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ก.ค. 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

ความคิดเห็น • 29

  • @user-ip9kr9nz9t
    @user-ip9kr9nz9t 20 วันที่ผ่านมา +15

    The level motivation this guy has is astounding

    • @princenagar1686
      @princenagar1686 18 วันที่ผ่านมา +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 16 วันที่ผ่านมา

      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

  • @vaxxnsh
    @vaxxnsh 19 วันที่ผ่านมา +3

    Maksad pura ho gya 👍

  • @satwiktatikonda764
    @satwiktatikonda764 20 วันที่ผ่านมา +9

    how are you this much consistent bro😱😱

    • @princenagar1686
      @princenagar1686 18 วันที่ผ่านมา

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

  • @youcanyouwill2004
    @youcanyouwill2004 4 วันที่ผ่านมา

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

  • @Munchen888
    @Munchen888 20 วันที่ผ่านมา +2

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

  • @parthbhalerao3669
    @parthbhalerao3669 19 วันที่ผ่านมา

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

  • @UNKNOWN-zm1jr
    @UNKNOWN-zm1jr 19 วันที่ผ่านมา

    Just amazing bro

  • @dhaanaanjaay
    @dhaanaanjaay 20 วันที่ผ่านมา +1

    You and neetcode both rock🤟🤟🤟

  • @AmanKumar-cc9ui
    @AmanKumar-cc9ui 19 วันที่ผ่านมา +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).

  • @mohammedansil2302
    @mohammedansil2302 18 วันที่ผ่านมา

    great video

  • @6mahine_mein_google
    @6mahine_mein_google 20 วันที่ผ่านมา

    @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 .

  • @deepakchalla495
    @deepakchalla495 19 วันที่ผ่านมา

    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 20 วันที่ผ่านมา +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 20 วันที่ผ่านมา +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 20 วันที่ผ่านมา

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

    • @arnavkaul7827
      @arnavkaul7827 19 วันที่ผ่านมา +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

  • @rhydhamsingla9597
    @rhydhamsingla9597 20 วันที่ผ่านมา +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 20 วันที่ผ่านมา +1

    Have they asked AVL Tree by using confusing language?

  • @princenagar1686
    @princenagar1686 18 วันที่ผ่านมา +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.

    • @harshmaheshwari8631
      @harshmaheshwari8631 15 วันที่ผ่านมา +2

      exactly

    • @princenagar1686
      @princenagar1686 14 วันที่ผ่านมา +1

      @@harshmaheshwari8631 yeah it's truth, if he can fix it, he will be next

  • @theUnkown617
    @theUnkown617 19 วันที่ผ่านมา

    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 ?

  • @shahzodshafizod
    @shahzodshafizod 20 วันที่ผ่านมา +1

    Simpil bro, simpil)

  • @aerinpatel8467
    @aerinpatel8467 19 วันที่ผ่านมา

    Hard to Move On 👀

  • @prathmeshsananse7064
    @prathmeshsananse7064 15 วันที่ผ่านมา

    Amazing work man, keep it coming