Serialize & Deserialize A Binary Tree - Crafting Recursive Solutions To Interview Problems

Ғылым және технология

Code & Problem Statement @ backtobackswe.com/platform/co...
Free 5-Day Mini-Course: backtobackswe.com
Try Our Full Platform: backtobackswe.com/pricing
📹 Intuitive Video Explanations
🏃 Run Code As You Learn
💾 Save Progress
❓New Unseen Questions
🔎 Get All Solutions
Question: Given a root node for a binary tree, serialize the binary tree into a string representation. Deserialize that same string representation into a tree identical to the original tree given.
The key is to understand what our fundamental operation/job is in each call to the function.
Our fundamental job is to encode/materialize a single node/int value.
Compiler Design Phases: www.geeksforgeeks.org/compile...
++++++++++++++++++++++++++++++++++++++++++++++++++
HackerRank: / @hackerrankofficial
Tuschar Roy: / tusharroy2525
GeeksForGeeks: / @geeksforgeeksvideos
Jarvis Johnson: / vsympathyv
Success In Tech: / @successintech
++++++++++++++++++++++++++++++++++++++++++++++++++
Elements of Programming Interviews problem 10.13

Пікірлер: 385

  • @BackToBackSWE
    @BackToBackSWE5 жыл бұрын

    Table of Contents: The Problem Introduction 0:00 - 0:55 Drawing A Parallel 0:55 - 3:19 Deciding How To Traverse & Encode The Tree 3:19 - 4:05 Let's Begin Crafting .serialize() 4:05 - 4:25 Flashback 4:25 - 7:34 Crafting .deserialize(): How Do We Track State? 7:34 - 12:29 Can You Visualize This In Your Brain? 12:29 - 13:28 That's All 13:28 - 14:19 Wrap Up 14:19 - 14:59 The code for this problem is in the description. Fully commented solely for teaching purposes.

  • @atanxellos2160

    @atanxellos2160

    4 жыл бұрын

    Great video! Thank you a lot! Really liked how you described step-by-step thinking, including incorrect direction and small tips (like a queue). Also, noticed a mistake on deserialization code: kzread.info/dash/bejne/pamek9SoaLevhrw.html Both pointers point to the left node, instead of left and right.

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    ok

  • @ousmand742
    @ousmand7424 жыл бұрын

    When Im stuck on a problem I say a silent prayer that BackToBack SWE has covered it on video

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    lmao

  • @sandhyagupta7359

    @sandhyagupta7359

    4 жыл бұрын

    that is so true

  • @akshay8675

    @akshay8675

    3 жыл бұрын

    💯

  • @raevenbauto1578

    @raevenbauto1578

    3 жыл бұрын

    Lmao this is so accurate!

  • @willturner3440

    @willturner3440

    3 жыл бұрын

    😂LMAO

  • @ahmadkhaled4233
    @ahmadkhaled42334 жыл бұрын

    thx Bro

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    nice!!

  • @lilley2595

    @lilley2595

    4 жыл бұрын

    ممكن اعرف ايه المصادر اللي درستها للمقابله

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    @@lilley2595 Indeed.

  • @ahmadkhaled4233

    @ahmadkhaled4233

    4 жыл бұрын

    @@lilley2595 Before the interview I started revising some object oriented programming from GeeksForGeeks, then I solved some SQL problems from HackerRank. Regarding Data structures and Algorithms u need to revise the main concepts like: linear data structures, trees, graphs and sorting. watch Back To Back SWE videos it's so simple, then you can do more practice on leetcode!

  • @AidenLeeyong
    @AidenLeeyong5 жыл бұрын

    I really liked that you also explained mental barriers like this. I appreciate it.

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    haha nice

  • @malihaislam711
    @malihaislam7114 жыл бұрын

    Ben, your explanations are amazing! Every time I get stuck doing a problem, I just pray that you have a video on how to solve it because none of the other KZread videos stick as well as yours do. Thank you so much for this!

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    hahaha nice, well glad to head that

  • @sarthakgupta072

    @sarthakgupta072

    4 жыл бұрын

    +1

  • @sihatafnan5450
    @sihatafnan54503 жыл бұрын

    The way you try to emulate our thought process in our brain is amazing.

  • @BasharAlkhalili
    @BasharAlkhalili4 жыл бұрын

    At first I used complex serialization with braces and commas and had to write my own string generator and parser. I also used index tracking when decoding. The code worked, but the performance was abysmal! Turns out that all of this could be avoided: - A comma for separation is enough for serialization, - str.split(',') is enough to turn the string into a list of tokens for de-serialization, and - deque(tokens) is great to hold the values. Left-popping the deque does away with the index tracking. Not only the code is much smaller, but the performance shot up to the 85% percentile. Genius! Thank you Ben.

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    ye

  • @PankajC
    @PankajC5 жыл бұрын

    Thanks for explaining the thought process behind every step in the solution. A lot of youtubers and websites just give you the solution but in a real interview you have to express your thought process and it is more important than the actual solution. Please keep covering the thought process in your future videos too. You're doing a great job!

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    sure

  • @andrewcrenwelge5592
    @andrewcrenwelge55925 жыл бұрын

    This was immensely helpful for clarifying my confusion on the details when I was trying to implement this myself. I really like how you walk through your thought process step by step. Thank you!

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    sure

  • @CollectConnectDots
    @CollectConnectDots4 жыл бұрын

    This world needs a teacher like you. I would suggest that you do a full time teacher and teach the next generation on how to approach the problem and think about the solution.

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    ye- we shall see what i do

  • @Chaitra.Rai.
    @Chaitra.Rai.4 жыл бұрын

    I just found this video and this channel, can't believe I did not come across this ever. I was stuck bad time and its a treasure, and the way you explained everything totally worth it! Thank you!

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    welcome

  • @hassankazmi5443
    @hassankazmi54434 жыл бұрын

    Keep up the great work my man, doing all of us of a great favor! Spread the knowledge!

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    ye

  • @atulmalakar
    @atulmalakar4 жыл бұрын

    OMG ! Brilliant Explanation. And I keep saying this in every video of yours, can't help myself !

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    ha, im decent

  • @harshitrastogi9078
    @harshitrastogi90785 жыл бұрын

    This is the best explanation of this problem ever given. Great job!

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    thanks

  • @SergeNevsky
    @SergeNevsky3 жыл бұрын

    It's really cool to see that you wanted to reach 100k+ subscribers in two years, and now two years later you're at 138k.

  • @yiyingzhang9585
    @yiyingzhang95854 жыл бұрын

    Man, you might not the best in technical problem, but you must the be the best to articulate them! Great job. I hope(and i believe!) you can go a long way in any big name company or may become a professor in college.

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    ye

  • @D-Daws
    @D-Daws4 жыл бұрын

    Such a high quality and complete video. The text animations really helped solidify my understanding of the solution.

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    nice

  • @PoshanBastola
    @PoshanBastola4 жыл бұрын

    Wow, I was just overthinking this thing. You made it look so simple!Thanks!

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    Nah, it is pretty hard at first, this is a polished video and doesn't reflect seeing the question for a first time

  • @akhildhiman8791
    @akhildhiman87914 жыл бұрын

    Broo!! You are awesome I was stuck on this question for the whole day but after watching this video this hard problem felt like too easy. Thanks a ton for this video!

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    No ur awesome

  • @uncaged3076
    @uncaged30763 жыл бұрын

    Glad that you achieved and surpassed your 100k goal. Thanks for your videos

  • @priyankajadhav2405
    @priyankajadhav24052 жыл бұрын

    Love the way you explained the problem by breaking it down, please keep posting Medium and Hard questions, it would really help.

  • @yudiks
    @yudiks5 жыл бұрын

    Oh great job with the explanations. I felt like i learnt something new.

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    nice

  • @ericj1380
    @ericj13804 жыл бұрын

    Love the channel and truly appreciate all your efforts to help others better understand these topics.

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    sure

  • @EsotericArnold
    @EsotericArnold4 жыл бұрын

    this is amazing! I kind of got it from binging on your work yesterday but this really lays the idea and the way of reasoning about the tree traversal, flat for me.

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    great to hear

  • @ekejma
    @ekejma3 жыл бұрын

    HIs talent for explaining is just what you need for a deeper understanding.

  • @azharhaque4217
    @azharhaque42172 жыл бұрын

    Just watching this video first time, hearing you say you want 100k subscribers in a year or two, seeing the video came out 2 years ago, and seeing 188k subscribers made me happy for you

  • @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 😀

  • @df4privateyoutube722
    @df4privateyoutube7224 жыл бұрын

    Congrats on 100K! Pretty big achievement on your end - big resume flex too haha

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    thanks - I have no interest in creating a good looking resume. I only want to make legitimate things in the world that are very large and help people.

  • @trudyandgeorge
    @trudyandgeorge4 жыл бұрын

    I just subbed. I've never before subbed when asked, it always sounds needy and annoying but somehow your totally genuine plea got me like "yeah, this dude needs subs" Great video mate. Keep it up

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    hahahahahaha thanks

  • @anuragtiwari3032
    @anuragtiwari30322 жыл бұрын

    Pls come back, you'll get this channel to 10 million ,who cares about 100k. Anyways hope ur doing good and ur one of the best teachers I've ever known!!

  • @darod6098
    @darod60985 жыл бұрын

    Hi there. Just to say that this question was asked to me in an interview in a big N. Thanks for your work, you are absolutely the best!

  • @darod6098

    @darod6098

    5 жыл бұрын

    Please keep doing this videos! You are amazing.

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    sure

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    @@darod6098 ok

  • @monicakulkarni3319
    @monicakulkarni33195 жыл бұрын

    I loved the way you explained this! Thank you so much, subscribed.

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    aw thanks

  • @bryanlozano8905
    @bryanlozano89053 жыл бұрын

    Wow, just got this question in the wild. Thanks for helping me ACE a phone screen!

  • @tanmaychandra9434
    @tanmaychandra94342 жыл бұрын

    This was fucking awesome, man. Interviewer will go crazy if explained like this in actuall interview. Respect Man!

  • @mohammednadeem333
    @mohammednadeem3334 жыл бұрын

    I really like your approach of thinking to the problem and decomposing it into steps. Thank you very much. Please keep posting such videos especially on dynamic programming which is kind off little hard. Thanks again for helping the society!!!!!! :)

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    ok

  • @MZ-uv3sr
    @MZ-uv3sr2 жыл бұрын

    ooh, so much better than the first one I saw, thank you

  • @UHemanthaKumar
    @UHemanthaKumar3 жыл бұрын

    You are the best teacher I have seen in my entire life sir! Thank You so much for ur efforts!

  • @BackToBackSWE

    @BackToBackSWE

    3 жыл бұрын

    sure!

  • @VigneshDhakshinamoorthy
    @VigneshDhakshinamoorthy3 жыл бұрын

    You are awesome, and I see that you hit your 100k Mark! Cheers brother. Here is to a million!

  • @BackToBackSWE

    @BackToBackSWE

    3 жыл бұрын

    indeed we did and yes

  • @bibliophileanki
    @bibliophileanki4 жыл бұрын

    Great video and crisp explanation. Understood the serialization, but still trying to comprehend the deserialization. New subscribre here!! Keep up the good work.

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    yoyo

  • @saigundlapalli3548
    @saigundlapalli35485 жыл бұрын

    I would be very interested in seeing you do a mock interview through one of these videos. Maybe grab a friend and interview each other and see how that pans out for content

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    Yeah haha, Ive though of this and may do a few this Fall. I'm launching a course & will shift all my focused teaching there and may get more creative here on the channel.

  • @shivabhusal5328
    @shivabhusal53284 жыл бұрын

    Brilliant explanation! Made my day! Thank you so much.

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    sure

  • @9429963654
    @94299636545 жыл бұрын

    Wow! That was so very well done. A lot of tutorials just say that "Use a Queue" and mostly don't explain "WHY". You sir, did that part and you did it beautifully! Good Luck and I hope you hit 100K subs soon! ♥️

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    Haha thanks and yeah, it'll happen with time. I'm impatient.

  • @9429963654

    @9429963654

    5 жыл бұрын

    @@BackToBackSWE haha, cover yourself with more problems and you won't have the time to think about the sub count ;)

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    @@9429963654 😏😏

  • @shruthib3366
    @shruthib33664 жыл бұрын

    Really loved the way you helped us understand it!

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    sure

  • @danni6113
    @danni61135 жыл бұрын

    Your explanation is so clean and easy to understand! New subscriber here ;)

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    yo, thanks

  • @geekySRM
    @geekySRM3 жыл бұрын

    This was beautiful!

  • @satviksharma4897
    @satviksharma48974 жыл бұрын

    Thanks for such a great explanation. Please keep up the good work. Thanks!

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    sure, ok, and thanks

  • @niyas09
    @niyas095 жыл бұрын

    i really like your explanation on tress problems.. helped me a lot.. great job!

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    nice

  • @NubmerSeven
    @NubmerSeven5 жыл бұрын

    Amazing stuff dude, already recommending to friends :)

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    thanks

  • @ashishkumarchoubey5592
    @ashishkumarchoubey55923 жыл бұрын

    Oh man! You are simply great

  • @karthikmucheli7930
    @karthikmucheli79305 жыл бұрын

    Dude you are so amazing. Thank God you exist.

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    hahahahahaha, I've almost died like 2 times, I feel the same ha

  • @omkarvaidya8520
    @omkarvaidya85204 жыл бұрын

    Great Explanation. I understood the concept very well. Thank You so much for the series of videos, it really helps a lot. Just a small correction in the serialize method - Just add extra separator "," after the leftSubtree as well. While returning, make the change in the code as: return root.val + "," + leftSubtree + "," + rightSubtree; Because if you don't add the extra "," and try to solve the leet code problem, it will give you the error for bad input String "XX3" as it won't be able to deserialize it to Integer value while creating the node.

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    thanks

  • @suyashsavji5189
    @suyashsavji51893 жыл бұрын

    He doesn't even need to write anything, visualization does the work. Legend.

  • @adebs
    @adebs4 жыл бұрын

    amazing explanation, thank you so much!

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    sure

  • @sairammaddala9069
    @sairammaddala90699 ай бұрын

    This is by far the best explanation I have seen for this problem, Thank you

  • @BackToBackSWE

    @BackToBackSWE

    9 ай бұрын

    Happy Halloween 🎃 Very nice of you, sairammaddala! Let us know other topics we could cover! We'd love to offer you 50% Off our exclusive lifetime membership use the code SPOOKY50 - backtobackswe.com/checkout?plan=lifetime-legacy&discount_code=SPOOKY50

  • @dpfit
    @dpfit4 жыл бұрын

    Such a beautiful explanation. Thank you so much.. Subscribed right away. :)

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    sure

  • @yzmashuai
    @yzmashuai4 жыл бұрын

    The best explanation I have ever watched.

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    thanks

  • @manojkumar16
    @manojkumar164 жыл бұрын

    Very beautifully explained. Thanks a ton!!!

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    sure

  • @ankitshah692
    @ankitshah6924 жыл бұрын

    Very clear and nice explanations dude ! You rock ! You just got a subscriber

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    thank

  • @Max-zf5ot
    @Max-zf5ot4 жыл бұрын

    You are absolutely amazing. I have been going through several DS/Algo tutorials but the effort you put in making things simple and understandable is simply remarkable. At this moment, what's the deficit between the contents of your course vs the contents available in this channel?

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    The course will be me posting materials (2-4 videos a week) and all my technical content will be there for the next 6 months or so. I'm posting more often, in more detail, & helping students in the fb group

  • @nokuthulambatha9980
    @nokuthulambatha99805 жыл бұрын

    Thanks a mil for this! Bless you.

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    sure

  • @manishrana3596
    @manishrana35963 жыл бұрын

    Congrats ! You acheived your goal

  • @BackToBackSWE

    @BackToBackSWE

    3 жыл бұрын

    yes I did

  • @kueen3032
    @kueen30324 жыл бұрын

    Its already 99.5k, dude u r close to 100k subs. Keep up the good work, well deserved!

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    Yeah, what a ride. The internet is to be thanked.

  • @kueen3032

    @kueen3032

    4 жыл бұрын

    @@BackToBackSWE Ben, just a suggestion for your later videos, explain iterative solution also. I did this question with recursion and level order traversal, that way you can teach more than one concept in a question.

  • @vipulkrishna19
    @vipulkrishna194 жыл бұрын

    loved it. good concept concerning about only one node

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    ye

  • @scottliu4987
    @scottliu49874 жыл бұрын

    I like it when the codes just pop out when you are coming out with the idea

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    ye, is' magic

  • @pirangitharun8736
    @pirangitharun87363 жыл бұрын

    I wish I become like you :) You explained it as clear as possible. Thank you so much

  • @vishnukumavat7489
    @vishnukumavat74894 жыл бұрын

    Thankx buddy, your way of explanation is awesome. Thanks once again.

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    thanks and ok

  • @mashak3765
    @mashak37653 жыл бұрын

    thank you so much for this tutorial. super clear and was able to solve that problem on leetcode right away.

  • @manojrajasekar6035
    @manojrajasekar60354 жыл бұрын

    Congratulations on 50k+ Subscribers Ben ! Keep doing the great job

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    Hahaha, I just noticed that recently. Yeah, thank you. I've been gone not because I'm actually gone, we are just working on a new platform we are launching late January. It is a "ground-up" rewrite of our website (client), api (backend), and we are writing a service to test code too. So in 3-6 months this channel will hopefully be very active again when this massive project is launched and we are just fixing bugs and making small tweaks. My goal for 2020 will be to have 300 content pieces in the platform, support 6 languages, and get this channel going again with more interesting kinds of content.

  • @manojrajasekar6035

    @manojrajasekar6035

    4 жыл бұрын

    @@BackToBackSWE OMG ! That's a great news ! Much Excited :) I was wondering and waiting for new video uploads. Got clarified now :) Looking forward to the new platform.

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    @@manojrajasekar6035 thx

  • @manojamrutharaj9071
    @manojamrutharaj90714 жыл бұрын

    Awesome. Yet another great presentation.

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    sure

  • @fatiharslan7849
    @fatiharslan78494 жыл бұрын

    Dude that was epic. Thanks a lot

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    thx and sure

  • @UrGuru
    @UrGuru4 жыл бұрын

    This is pure gold

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    Thanks

  • @willturner3440
    @willturner34403 жыл бұрын

    Bro keep uploading, you are gem of KZread

  • @enkr1
    @enkr1 Жыл бұрын

    the best channel i have found so far. so detailed but not to a point u will fall asleep. > i like the awk outro HAHAHAHAHHAHA

  • @BackToBackSWE

    @BackToBackSWE

    Жыл бұрын

    Hahaha Thank you 🎉 Please enjoy a special coupon from us - backtobackswe.com/checkout?plan=lifetime-legacy&discount_code=SUB 🚀

  • @kgotgit3437
    @kgotgit34373 жыл бұрын

    Thank you for the video. Explanation is really good

  • @anuragv400
    @anuragv4003 жыл бұрын

    Well explained !!

  • @osirus211
    @osirus2114 жыл бұрын

    Cool video, man. Thanks!

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    sure.

  • @Yobro1
    @Yobro15 жыл бұрын

    Thanks! Well explained.

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    thx

  • @ibrahimshaikh3642
    @ibrahimshaikh36423 жыл бұрын

    I like ur ways explanation. Starting from scratch. Keep it up

  • @BackToBackSWE

    @BackToBackSWE

    3 жыл бұрын

    ok

  • @b9944236
    @b99442369 ай бұрын

    Wow, after watching your explain then I can solve this question by myself. Thanks a lot !

  • @balaveeraraghavareddy9764
    @balaveeraraghavareddy97643 жыл бұрын

    awesome explanation helped me a lot

  • @goofenhour2697
    @goofenhour2697 Жыл бұрын

    Thank you! This helped a lot

  • @BackToBackSWE

    @BackToBackSWE

    Жыл бұрын

    Thank you, appreciate it 😄 Also check out our Free 5 Day DSA Interview Prep Mini-Course - backtobackswe.com/ 🎉

  • @prateekkanujiya9775
    @prateekkanujiya97755 жыл бұрын

    U are doing great job bro 👍

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    thanks

  • @hamsalekhavenkatesh3440
    @hamsalekhavenkatesh34402 жыл бұрын

    this is a very clever code where we are doing a bottom-up approach of pre-order traversal....from just looking, it will be like we are trying to do a post-order, but the way we combine string in serialize(..) is actually pre-order bottom up style.

  • @habtamuassegahegn4283
    @habtamuassegahegn42835 жыл бұрын

    thanks for answering dont forget to add about 2-3 trees...........keep it up men its good is better from other explanations

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    thx

  • @dhruvratangupta8920
    @dhruvratangupta89205 жыл бұрын

    you're the best, thanks a ton

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    sure

  • @disola6383
    @disola63834 жыл бұрын

    This is superb, for real.

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    thx

  • @cornorange7622
    @cornorange76223 жыл бұрын

    Thanks a lot for the video! I am still confused by one thing, there is leetcode questions like "Construct Binary Tree from Inorder and Postorder Traversal", which means you need two serialized data array (inorder and postorder) to decide how a tree is built right? Could you please explain a bit on this? Thank you!

  • @chaupham1186

    @chaupham1186

    2 жыл бұрын

    The difference here is that we add extra "nulls" when generating the order, allowing each tree we rebuild later on is unique. In the problem you said, there is no "null" in there, thus we need 2 orders to build the tree. For example, with preorder [1,2,3], there may be some trees that can be reconstructed, but if we add "null" to have a preorder of [1,2,3, null, null, null, null], we can only build a unique tree.

  • @chabhishyam
    @chabhishyam5 жыл бұрын

    Awesome explanation. All the best for your goal.

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    thx

  • @chiranjeevipippalla
    @chiranjeevipippalla3 жыл бұрын

    Problem + Fun + Solution = BackToBack SWE 👌

  • @BackToBackSWE

    @BackToBackSWE

    3 жыл бұрын

    ye

  • @Hav0c1000
    @Hav0c10004 жыл бұрын

    0mg... this one is trivial after your explanation... nice work!

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    nice

  • @sylviacampos3431
    @sylviacampos34313 жыл бұрын

    Amazing content!

  • @abhishekprasad6691
    @abhishekprasad66914 жыл бұрын

    Great use of data structures. Generally, the first instinct is to use a global state and when that is thwarted, I usually get flustered. This approach showed me a different way to tackle solutions. Also optimizations cz the global state would probably just add to the memory usage.

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    nice insights

  • @divyanshchowdhary5264
    @divyanshchowdhary52645 жыл бұрын

    Was asked a similar question in my interview, but instead of converting to string, had to convert it into linked list inplace. Can you please cover that in your video. Btw great video...love them♥️

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    Thanks and I'm not sure if I will cover that variant. That is kind of like problem 10.14 in Elements of Programming Interviews except the whole tree. Might not be large enough of a variation to warrant an individual video (because each video takes 4-6 hours to make I can't make that time allocation).

  • @QueenCoder
    @QueenCoder2 жыл бұрын

    The fact that he made it a fund raiser ❤

  • @UsamaBinLuha
    @UsamaBinLuha4 жыл бұрын

    awesome explanation!!!

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    thx

  • @abhilashgoyal2234
    @abhilashgoyal22344 жыл бұрын

    One of the best explanation. One request, please make a video on "How to picturise a recursion solution". Recursive solution are easy when you see them,but to think of those solution by yourself is not that easy. Thanks in advance

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    ok

  • @shashikantkumar5095
    @shashikantkumar50953 жыл бұрын

    I can only say thank you!!

  • @southern-sunshine
    @southern-sunshine4 жыл бұрын

    Awesome explanation...made my day

  • @BackToBackSWE

    @BackToBackSWE

    4 жыл бұрын

    sure

  • @suchitragiri4546
    @suchitragiri45463 жыл бұрын

    Outstanding!!👍

  • @BackToBackSWE

    @BackToBackSWE

    3 жыл бұрын

    thx

  • @kapilchhipa2143
    @kapilchhipa21435 жыл бұрын

    nicely explained i have become fan of u.

  • @BackToBackSWE

    @BackToBackSWE

    5 жыл бұрын

    thanks

  • @moeal5110
    @moeal51102 жыл бұрын

    And here you are in 100K subscribers. You guys are awesome! Edit: I am considering paid subscription is everything is explained in java?

Келесі