Test If A Binary Tree Is Symmetric ("Symmetric Tree" on Leetcode)

Поділитися
Вставка
  • Опубліковано 21 гру 2024

КОМЕНТАРІ • 136

  • @BackToBackSWE
    @BackToBackSWE  6 років тому +7

    Table of Contents:
    Video Setup 0:00 - 0:18
    Problem Introduction 0:18 - 2:45
    Find The Pattern With An Array 2:45 - 4:20
    Find The Pattern With A Binary Tree 4:20 - 6:48
    The Code. 6:48 - 9:17
    Time & Space Complexity 9:17 - 10:58
    Apply This To Other Recursive Problems 10:58 - 12:05
    As with every video, I'm not perfect, I hope I didn't make any gross mistakes in the video. If all is well, great, this is the explanation for how to test if a binary tree is symmetric.

  • @yashshreeshinde4394
    @yashshreeshinde4394 4 роки тому +34

    Please don't feel sorry for being loud,that's your speciality when you talk ;
    it feels like a professional teacher is teaching and he wants all his students to pass in any cost.

    • @BackToBackSWE
      @BackToBackSWE  4 роки тому +10

      lol ok, old videos had bad gear and no mic, and yeah I gave my life for 1.5 years to make these videos I want everyone to pass at any cost lol

  • @soumyadeeproy6611
    @soumyadeeproy6611 4 роки тому +7

    The energy in your explanation is just awesome,it makes everyone to listen your words with great concern,it is really true that positive person give off positive energy

  • @frankchen9264
    @frankchen9264 5 років тому +9

    Awesome video! I think you decouple this problem quite elegantly. Trying to solve a problem in a recursive way is not easy. You did a great job!

  • @vandit_quantum
    @vandit_quantum 4 роки тому +2

    The best explanation. Even the bubbling up guys 😆 like nick white and kevin fades in front of you! Increased my confidence dude. Who the hack disliked!! Complete disguise!

  • @smarchz
    @smarchz 2 роки тому +1

    Your video is so good. The explanation is super clear.

  • @rukuanyang3413
    @rukuanyang3413 5 років тому +3

    very nice, you are the best youtuber who can explain leetcode problems clearly and make them easy to understand.

  • @ruchikadakalia8972
    @ruchikadakalia8972 4 роки тому +5

    That was a fantastic explanation!!...It very well shows how passionate you are about your work...and believe me you can make people love data-stuctures..

  • @dephc0n1
    @dephc0n1 5 років тому +5

    Your editing has improved a ton! Keep up the good work.

  • @shtephl354
    @shtephl354 5 років тому +13

    Damn, if my interviewer had your energy in this video, i'd be half pumped / half having an anxiety attack. But anyways, I'm on a binge on your videos, thanks for the help!

  • @milipo23
    @milipo23 2 роки тому

    Thank you! I've been watching MIT lectures on data structures and algorithms and when I don't understand something, I always get a super clear explanation here! You're terrific at explaining things

    • @BackToBackSWE
      @BackToBackSWE  2 роки тому +1

      Thank You!!
      Do check out backtobackswe.com/platform/content
      and please recommend us to your family and friends :)

  • @muskantripathi626
    @muskantripathi626 4 роки тому +4

    Thankss Dudeee!!! finally, after this video i solved this problem successfully.

  • @mohamedarshathn7768
    @mohamedarshathn7768 5 років тому +3

    U deserve more likes and subscribers.

    • @BackToBackSWE
      @BackToBackSWE  5 років тому +1

      I know, eventually

    • @mohamedarshathn7768
      @mohamedarshathn7768 5 років тому +2

      @@BackToBackSWE I guess after watching your video, every one rushes to leetcode to solve that instead of a like😂😂

  • @anshulgupta7812
    @anshulgupta7812 4 роки тому +3

    Watching on X-mas day after 2 years :)

  • @pyak6761
    @pyak6761 4 роки тому +3

    lmao, "sustain our lives" i felt that

  • @digvijayyamagekar4300
    @digvijayyamagekar4300 3 роки тому

    thanks sir for the simplest explanation i have came across so far

  • @LilyEvans1996
    @LilyEvans1996 5 років тому +15

    duddeeeeeee! thankssssss!!!! I needed you in my life and I didn't even know until now

  • @vivekojha4807
    @vivekojha4807 4 роки тому +5

    Woah your energy boosted me as well. Thanks!

  • @AshwinKumarKayyoor
    @AshwinKumarKayyoor 5 років тому +2

    I studied at UMD. I am proud of you man!

    • @BackToBackSWE
      @BackToBackSWE  5 років тому

      Let's put turtles on the map 🐢🐢

  • @char7605
    @char7605 5 років тому +3

    You are so brilliant !! Thanks for making these videos.

  • @TheYaBoyKevin
    @TheYaBoyKevin 5 років тому +2

    Could I use an in order traversal to push all the values into a vector, then do a palindrome test in the vector?

    • @BackToBackSWE
      @BackToBackSWE  5 років тому

      how so?

    • @prabhjyotsingh139
      @prabhjyotsingh139 5 років тому

      Yes you can do that way, but before applying Inorder traversal convert the tree into complete binary tree.

    • @BackToBackSWE
      @BackToBackSWE  5 років тому +1

      @@prabhjyotsingh139 oh yeah I get it now, yeah you can do it like that as long as you make the provision for null nodes

    • @MarcStevens99
      @MarcStevens99 5 років тому +2

      Yes you can, the problem is that the time complexity will be O(n) in every case. The recursive solution is O(n) in worst case.

  • @robertommmin5
    @robertommmin5 Рік тому +1

    4 years later, still great

  • @lavishgarg4274
    @lavishgarg4274 5 років тому +2

    Salute you dude, hands down please make more problems about the graph theory, you are mindblowing

  • @Kgp-ty5dk
    @Kgp-ty5dk 5 років тому +2

    Thanks for the explanation boss. The space complexity part was great as well Call stack etc. Can you make a quick video on Min depth of binary tree. Algthough I understand it. But its a bit tricky!

  • @SamWhitlock
    @SamWhitlock 3 роки тому

    I think the space complexity is also O(n). The worst case is basically a symmetric list with the middle as the tree root. O(n/2) ≈ O(n), in terms of space for the stack frames

  • @lorenzovelasque3668
    @lorenzovelasque3668 2 роки тому

    Thanks for this video I really like the way you explain this problem

  • @ankitajain4194
    @ankitajain4194 5 років тому +2

    Awesome !!!! You have really good teaching skills.

  • @TheEminemrockz123
    @TheEminemrockz123 5 років тому +2

    Best explanation, hands down 👌

  • @djfedor
    @djfedor 6 років тому +1

    Fantastic videos, man! Thank you so much for your work! P.S.: It's very sad that you don't have many comments/views, but most importantly you're delivering the quality, so all these things will come soon! Awesome!

    • @BackToBackSWE
      @BackToBackSWE  6 років тому +4

      You have no idea how much that means to me! :)
      Every day I wonder if it is worth it to continue doing this. I have like 300 questions I want to cover (that I did while learning) and I realize that is a HUGE year-long project at the best if I keep it up.
      Normally videos have this breakdown:
      1 hr notes
      1 hr shooting
      2-6 hours editing
      30 minutes to publish
      Not sure how I can keep it up during school but we will see (it starts Jan. 28th)
      So yeah I think they are ok but holy crap they take a long time. I have a long story behind why I do these videos, but I have like an internal thing keeping me going despite knowing that literally no one watches right now.
      Thank you so much, I really appreciate this.

    • @qaipak1
      @qaipak1 5 років тому +1

      @@BackToBackSWE Keep doing them. These vids are the best. Listen if I get a the job I want from these vids I'm donating you 500 bucks!

    • @BackToBackSWE
      @BackToBackSWE  5 років тому

      @@qaipak1 haha ok

    • @LilyEvans1996
      @LilyEvans1996 5 років тому +1

      @@BackToBackSWE please continue if you can and have the desire! You are amazing!

    • @BackToBackSWE
      @BackToBackSWE  5 років тому

      @@LilyEvans1996 workin' on it

  • @telemachusantonius
    @telemachusantonius 5 років тому +2

    Nice explanation! Thanks for the video!

  • @bellahasguns
    @bellahasguns 4 роки тому +1

    like your passion dude

  • @somerandomguy000
    @somerandomguy000 3 роки тому

    You’re just a legend!

  • @qaipak1
    @qaipak1 5 років тому +2

    I have an interview in 2 days. If only I had seen your videos earlier :'(

  • @subhangijena4381
    @subhangijena4381 4 роки тому

    Please make more videos. why have you stopped making videos? Your channel is great bro.

    • @BackToBackSWE
      @BackToBackSWE  4 роки тому

      I'm working at Twitter and don't make public videos since we run backtobackswe.com

  • @neeravganate9562
    @neeravganate9562 4 роки тому +1

    you are great man !!! thanks

  • @zhaowencheng8690
    @zhaowencheng8690 4 роки тому +1

    Super thanks!

  • @rds6129
    @rds6129 5 років тому +4

    pause at 6:43 and you can see the solution. Otherwise you're standing in front of it the whole time dude.

  • @naveen3192
    @naveen3192 3 роки тому

    The energy is infectious 🚀

  • @mohamedarshathn7768
    @mohamedarshathn7768 5 років тому +2

    Bro please upload more video on trees. I am waiting for that.

  • @sarfarazalam6077
    @sarfarazalam6077 5 років тому +1

    Thank you, I did inorder traversal of the tree and then did palindrone . It passed 187 cases but failed 188 th case.

    • @BackToBackSWE
      @BackToBackSWE  5 років тому +1

      nice!

    • @Kev1nTheCoder
      @Kev1nTheCoder 5 років тому +1

      Same here.

    • @neeravganate9562
      @neeravganate9562 4 роки тому

      @@Kev1nTheCoder can you tell at which test case is it failing ???

    • @Kev1nTheCoder
      @Kev1nTheCoder 4 роки тому +1

      @@neeravganate9562 Sorry I don't remember. I checked the Leetcode but it turns out they changed their test cases.

    • @neeravganate9562
      @neeravganate9562 4 роки тому +1

      @@Kev1nTheCoder np got it now

  • @moftyu
    @moftyu 4 роки тому +1

    Love it mannn !!
    just one comment, try to decrease the energy just a little/
    Thank you so much !!

  • @shashwatagrawal8412
    @shashwatagrawal8412 5 років тому +1

    This was really helpful. Thanks a lot.
    Can you please make a video on Diameter of Binary Tree? It's really confusing and I am stuck on it. It would be really helpful if you could do that. Thanks

  • @sctam
    @sctam 6 років тому +1

    This is great, except you missed 5:13 in the table of contents! :)

  • @code20m
    @code20m 4 роки тому +2

    good as always :)
    thanks!

  • @codeblooded6760
    @codeblooded6760 4 роки тому +2

    One day you will know how to end your videos. We have faith in you.

  • @jamesfifth8479
    @jamesfifth8479 4 роки тому +1

    Hey man you are so great ! haha

  • @li028-x9i
    @li028-x9i 5 років тому +1

    But how to do it iteratively?

    • @BackToBackSWE
      @BackToBackSWE  5 років тому

      uh, I'd need to refresh myself on this problem

  • @CostaKazistov
    @CostaKazistov 3 роки тому

    7:47 nice rhyming symmetry

  • @ryujiganaha9645
    @ryujiganaha9645 4 роки тому +1

    Thank you!

  • @arunadang2130
    @arunadang2130 4 роки тому +1

    Brilliant

  • @quanzhang8411
    @quanzhang8411 5 років тому +1

    Very nice!!

  • @raninagare7678
    @raninagare7678 5 років тому +1

    You are just amazing !!!!!!

  • @gokulnaathb2627
    @gokulnaathb2627 3 роки тому

    Thank you, Sir, this helped

  • @WaitingInMyColdCell
    @WaitingInMyColdCell 4 роки тому

    Lovely video bruh. May the $$$ be with you.

    • @BackToBackSWE
      @BackToBackSWE  4 роки тому

      idc about $$$ only ok, ik that it may seem that way but I just need to fulfill my vision. And thx

  • @mrfun9841
    @mrfun9841 5 років тому +1

    funny and great explanation ) thanks a Lot ))

  • @chongbeiwang3706
    @chongbeiwang3706 5 років тому +1

    so good!

  • @yicai7
    @yicai7 3 роки тому

    Thanksssss!!!

  • @dheerajragala300
    @dheerajragala300 4 роки тому +1

    RIP to the people who disliked this

  • @lawrenberghanson4401
    @lawrenberghanson4401 5 років тому +4

    LOL, your endings. You can just say "thanks and see you next time" but I guess if you did that your endings wouldn't be special.

  • @enviphoenix
    @enviphoenix 3 роки тому

    At first i thought he was Lewis Hamilton :D

  • @fangyiyu2744
    @fangyiyu2744 4 роки тому +1

    You were really yelling in the early videos 😆

    • @BackToBackSWE
      @BackToBackSWE  4 роки тому +1

      Yeah I was, things improve over time if you just stay with them. A life lesson. We get better everyday.

  • @zelo_s6707
    @zelo_s6707 4 роки тому +1

    Oh lord I might as well have a heart attack right now : D

    • @BackToBackSWE
      @BackToBackSWE  4 роки тому

      what

    • @zelo_s6707
      @zelo_s6707 4 роки тому

      @@BackToBackSWE Still teaching in the same library room now?
      Also, do you have any tips on how to remember the code for problems you've done, thanks!

  • @ronpb3943
    @ronpb3943 2 роки тому

    You're the one

    • @BackToBackSWE
      @BackToBackSWE  2 роки тому

      Thank you, glad you liked it 😀
      Do check out backtobackswe.com/platform/content
      and please recommend us to your family and friends 😀

  • @nknidhi321
    @nknidhi321 3 роки тому

    awesome :)

  • @satvikkhare1844
    @satvikkhare1844 3 роки тому

    Why are you standing in front of the code 99% of the time?

  • @khan.mansoor
    @khan.mansoor 3 роки тому

    You're moving way too much and it's a bit distracting otherwise you're a wonderful instructor.

  • @zyro9922
    @zyro9922 4 роки тому +1

    Loved it