Software interview question - Reverse a linked list recursively

  Рет қаралды 25,334

Jesse Dietrichson

Jesse Dietrichson

Күн бұрын

Пікірлер: 78
@waiyanleung5199
@waiyanleung5199 4 жыл бұрын
Finally I understand the recursive method with this video after I spent a whole day digging through tons of other learning materials on the web.
@iam_tigress
@iam_tigress 4 жыл бұрын
same here!! I watched videos until I found this gold right here! I GOT IT NOW. Thank you Jesse!!!
@mobiledeveloper6068
@mobiledeveloper6068 4 жыл бұрын
I also spent all-day digging through materials. even try to trace every step in my code and I am still confused until this video. 10:30 - 10:40 is all I need...I think 99% of people just pretend they understand this simple algorithm that is why they can't really explain it.
@benwozi6166
@benwozi6166 3 жыл бұрын
​@@mobiledeveloper6068 hey I understood most of the part but I am really confused how the 5 remains in the variable head. For example: head = reverse(node.next); node.next.next = node, node.next = null, return head. The caller when reached 5 it returned 5 now the head variable has the value 5 when the caller returned back to 4 but when the caller returned back to 3 why not the head value is updated with 4?? Hope you got my question.
@benwozi6166
@benwozi6166 3 жыл бұрын
@@iam_tigress ​ hey I understood most of the part but I am really confused how the 5 remains in the variable head. For example: head = reverse(node.next); node.next.next = node, node.next = null, return head. The caller when reached 5 it returned 5 now the head variable has the value 5 when the caller returned back to 4 but when the caller returned back to 3 why not the head value is updated with 4?? Hope you got my question.
@benwozi6166
@benwozi6166 3 жыл бұрын
hey I understood most of the part but I am really confused how the 5 remains in the variable head. For example: head = reverse(node.next); node.next.next = node, node.next = null, return head. The caller when reached 5 it returned 5 now the head variable has the value 5 when the caller returned back to 4 but when the caller returned back to 3 why not the head value is updated with 4?? Hope you got my question.
@akihana4113
@akihana4113 4 жыл бұрын
This is the best reverse linked list in recursive tutorial I've ever seen.
@paragnaik9826
@paragnaik9826 3 жыл бұрын
truly underrated video...explains recursion clearly
@piglovesasy
@piglovesasy 3 ай бұрын
love this! much better than any other ones out there, cant stand the other ones
@ustunkaya
@ustunkaya 2 жыл бұрын
This is a very articulate explanation, thanks Jesse. Making something look so simple is an art.
@sanjeevchopra2381
@sanjeevchopra2381 3 жыл бұрын
He has expained the concept the best way. others were confusing . I am talking about whole of Internet. I want to know why one person has disliked the video.
@AhmedMarzookisabeast
@AhmedMarzookisabeast Ай бұрын
Man the visual was such a great way to explain it made everything click so much
@grindinglcmeow
@grindinglcmeow 8 ай бұрын
The animation is a super clean explanation to the `node-->next->next` confusion!! Big thanks mate.
@rdwok14
@rdwok14 Жыл бұрын
I finally understood the recursive solution after watching your video. In one sentence: the sub-problem is setting the next node's next the current node, and then setting the current node's next to null.
@rochelleroberts5837
@rochelleroberts5837 4 жыл бұрын
Thanks for spending extra time explaining node.next.next = node. I really appreciated you breaking it down! Thanks again.
@SangriaSarah
@SangriaSarah 3 ай бұрын
This is so helpful and thorough. the visuals are fantastic. thank you for putting this together i'm sure it took a lot of work! helped so many people understand it better
@jaidaayasser1260
@jaidaayasser1260 2 жыл бұрын
The best explanation! I wish all linkedList problems are solved like that! You're the best Thank you
@ledinhanhtan
@ledinhanhtan Жыл бұрын
I feel relieved after what your explanation. Thank you!
@urrahman196
@urrahman196 3 жыл бұрын
this is the best so far on recursion, thanks a lot buddy. Very intuitive.
@444brando
@444brando 4 жыл бұрын
The detail and clarity in this video was perfect!
@karimmessaoud8223
@karimmessaoud8223 2 жыл бұрын
Very good explanation of all the algorithms episodes. Thank you! Next would be welcome.
@akhilr94
@akhilr94 2 жыл бұрын
Finally! This is what I needed. Thank you so much. I used to think, once 5 is returned by last fn call, ie reverseList(4) why can't we do head.next = node. But that'd only result in [5,4], [5,3],etc for each call. Even if I make it work, which is possible. By the end of all calls, I will not have the new head of the reversedList altho the list might be reversed. This video helped me understand that we are return 5 all the way back to the first call. That is the gotcha for this algo in my opinion.
@acca1461
@acca1461 5 жыл бұрын
I like your explanations before implementing the algorithms
@santhoshkumarrajan4963
@santhoshkumarrajan4963 2 жыл бұрын
Loud and Clear! Thanks for the explanation!
@ikrenji8125
@ikrenji8125 2 жыл бұрын
excellent. the tricky part for me was understanding node.next, but this video cleared it up
@lennythach607
@lennythach607 2 жыл бұрын
Absolutely Brilliant! Keep making these videos Jesse!
@sahilrizvi3039
@sahilrizvi3039 3 жыл бұрын
Love you bro ❤️❤️, after wasting 3hrs i finally understand how this Work.
@tanmayasamaltk64
@tanmayasamaltk64 3 жыл бұрын
The best explanation is here. I can guarantee that student will have no fear of recursion after watching this love ❣️from my side.
@michaelgreim5000
@michaelgreim5000 4 жыл бұрын
This is the only video that made sense to me. Thanks so much!
@carefree_ladka
@carefree_ladka Жыл бұрын
Finally understood the recursive approach. Thanks a lot
@Jgrabow1985
@Jgrabow1985 2 жыл бұрын
Oh my god. This is actually the best explanation of any algorithm I think I have ever seen. You should really do more!
@parmeetsingh2479
@parmeetsingh2479 4 жыл бұрын
I saw many explanations but this is my favorite 🙌 Explained amazingly 👏
@abhinav8385
@abhinav8385 2 жыл бұрын
thank you so much! saw tons of videos on net, still no use. after hours & hours of finding found it!
@chiefsittingstill6061
@chiefsittingstill6061 3 жыл бұрын
Grand job, thanks. The visualisation of the logic in Powerpoint really helps, but for me it was the crystal clear explanation of what node->next->next = node (to use the C++ syntax) is doing, a line of code that seems mystifying at first, that really clinched it.
@horaciocastillodelrio5967
@horaciocastillodelrio5967 4 жыл бұрын
Damn this is the only video that explains the whole thing!! Thank You Man!
@StyleBySabina
@StyleBySabina 3 жыл бұрын
Perfect explanation! Finally understood reversing a linked list, thank you!
@chetterhummin1482
@chetterhummin1482 Ай бұрын
Great explanation, very clear, thank you!
@Oliver-nt8pw
@Oliver-nt8pw 10 ай бұрын
This is a very good video! Really helped me to understand!
@stealth1726
@stealth1726 4 жыл бұрын
Hey Jesse, just wondering if your planning on releasing anymore videos or courses, as they are incredibly helpful, thanks for the great content.
@lukeguan1397
@lukeguan1397 4 жыл бұрын
That is an amazing explanation.
@krishnavishwakarma9062
@krishnavishwakarma9062 3 жыл бұрын
Thank you brother... I have cleared my doubt through this video.. 🙃
@TheMustafa5233
@TheMustafa5233 Жыл бұрын
Thank you for this; all lighted up @ 9:25
@baothach9259
@baothach9259 Жыл бұрын
Excellent video!!!
@kunpeng8646
@kunpeng8646 4 жыл бұрын
Thanks for sharing, what a fantastic job you did!
@muhisaleh4598
@muhisaleh4598 2 жыл бұрын
thnx a lot :)) finally i got this recursion !!!!!!!!
@phanmarreddy579
@phanmarreddy579 Жыл бұрын
really nice visualization !!!!
@jacklo32
@jacklo32 Жыл бұрын
amazing explanation !
@milesl577
@milesl577 2 жыл бұрын
Your video is very helpful
@AppleDeuceTTV
@AppleDeuceTTV 2 ай бұрын
This is great. Your demonstration of node.next.next helped me out a ton.
@erichubbard4569
@erichubbard4569 4 жыл бұрын
THANK YOU. I didnt understand that it returns five to the previous caller, I didnt even know that was a thing.
@tiennguyenthuy7563
@tiennguyenthuy7563 2 жыл бұрын
Very helpful. Thank you
@mouaz_ahmed_siam
@mouaz_ahmed_siam 2 ай бұрын
it's amazing explain thank you much
@swapnil1175
@swapnil1175 4 жыл бұрын
THANK YOU.....it was really helpful
@jamesrockybullin5250
@jamesrockybullin5250 5 жыл бұрын
I'm very new to linked lists and recursion, but returning the new Head value recursively through all the nodes seems pretty wasteful/inefficient. Surely the whole point of a linked list is that a middle node, say node3, does not need to be concerned with where the list starts or ends? I did it the same way because the question said to do it recursively. But, in the real world, would you determine the new Head iteratively? This would simplify the recursive method and it seems to me like it would make the code run a bit faster. Would it? Or is it better to stick all of the functionality in one place and do everything recursively?
@girirajrdx7277
@girirajrdx7277 2 жыл бұрын
recurssion does the work only on its way back....while linked list being manipulated we are also doing the return of new head with it....complexity may be at 2n which is just O(n) (which is also for a iteration)
@abhisheksuryavanshi9675
@abhisheksuryavanshi9675 4 жыл бұрын
Ladies and Gentlemen, now that's how you explain reversing a linked list using recursion
@abdullokhalimov2012
@abdullokhalimov2012 2 жыл бұрын
Thank you a lot!
@fredflintstone8048
@fredflintstone8048 5 жыл бұрын
Excellent!
@German-ov9de
@German-ov9de Жыл бұрын
Subscribed
@ScitechExplorerEnglish
@ScitechExplorerEnglish 2 жыл бұрын
Hi sir I have questions : how can we declare a delegate for an overloaded method
@chien-yucode992
@chien-yucode992 8 ай бұрын
Nice!
@nicholasmciver5932
@nicholasmciver5932 4 жыл бұрын
You Should Do a tutorial on Linq and LinqPad
@carsten2600
@carsten2600 Жыл бұрын
OMG ur legend!
@stanleylew1688
@stanleylew1688 Жыл бұрын
Thanks! 🙏
@saeedmirzaei1
@saeedmirzaei1 3 жыл бұрын
I appreciate!
@andjelaarsic9217
@andjelaarsic9217 2 жыл бұрын
Thanks!
@theashero
@theashero 5 жыл бұрын
Hi Jesse, Could you please share the book name and writer name which you referred while uploading the videos for Exam 70-483. I love those videos and going through them and will soon give the exam. Thank You So Much for all your videos.
@syedhassanfarman3566
@syedhassanfarman3566 4 жыл бұрын
Are you goin to complet Exam 70-483: Programming with C# series ?
@benwozi6166
@benwozi6166 3 жыл бұрын
​ hey I understood most of the part but I am really confused how the 5 remains in the variable head. For example: head = reverse(node.next); node.next.next = node, node.next = null, return head. The caller when reached 5 it returned 5 now the head variable has the value 5 when the caller returned back to 4 but when the caller returned back to 3 why not the head value is updated with 4?? Hope you got my question. Thanks in advance
@farisal_homsi4826
@farisal_homsi4826 5 жыл бұрын
Jesse, Jesse, we have to cook, ah I mean code
@earthlingthings
@earthlingthings 2 ай бұрын
You could simply use a threaded binary tree easy as
@tianyiwang4820
@tianyiwang4820 4 жыл бұрын
thanks
@VinuP2023
@VinuP2023 5 жыл бұрын
Thanks much
@Blowyourspot747
@Blowyourspot747 3 жыл бұрын
For the algo
@abhishek-kapoor
@abhishek-kapoor 4 жыл бұрын
thx
@poikilotherm5611
@poikilotherm5611 2 жыл бұрын
😀
@antonsemenov7176
@antonsemenov7176 2 жыл бұрын
not clear explanation
@ANIRUDHADEY-t5y
@ANIRUDHADEY-t5y 4 ай бұрын
Finally I understand the recursive method with this video after I spent a whole day digging through tons of other learning materials on the web.
Reverse a Linked List: Recursive | Java
19:28
Chill_CS
Рет қаралды 28 М.
Reverse Linked List Recursively
10:27
CppNuts
Рет қаралды 4,9 М.
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 211 МЛН
This Game Is Wild...
00:19
MrBeast
Рет қаралды 154 МЛН
Software interview question - Number of islands
24:42
Jesse Dietrichson
Рет қаралды 2,1 М.
Linked Lists for Technical Interviews - Full Course
1:27:24
freeCodeCamp.org
Рет қаралды 366 М.
Reverse Linked List | EP 10
22:27
Fraz
Рет қаралды 36 М.
5 Simple Steps for Solving Any Recursive Problem
21:03
Reducible
Рет қаралды 1,2 МЛН
Object-Oriented Programming is Embarrassing: 4 Short Examples
28:03
Brian Will
Рет қаралды 2,1 МЛН
Recursive Linked List from Scratch
26:45
Coderbyte
Рет қаралды 18 М.
Introduction to Linked Lists (Data Structures & Algorithms #5)
18:47
Reverse Linked List Recursively
16:30
Knowledge Center
Рет қаралды 5 М.
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 211 МЛН