Towers of Hanoi: A Complete Recursive Visualization

preview_player
Показать описание
This video is about an in depth look at one of the most challenging recursive problems for computer science students: Towers of Hanoi. We first take the perspective of how we would solve it if it was just a puzzle, where we look specifically at developing a general strategy. Afterwards, we then convert this strategy into a complete recursive solution to the problem. On the way to this solution, we learn a framework to think about and solve tough recursive problems like this one. We finish the video by take a step back and analyzing the recursive solution and how the recursion unravels.

Music:
November by Kai Engel
Cobweb Morning by Kai Engel
Рекомендации по теме
Комментарии
Автор

If you keep making videos like this, you'll become the best and most famous CS teacher on Youtube.

boredpotato
Автор

Now I realized that the steps for recursive problem solving is basically the same steps taken in induction proofs in mathematics.

leonardofillipe
Автор

I am a simple person, I see recursion, I panic.

anujjadhav
Автор

I can’t even belive that the video of this quality has so few views. Keep up the good work!

markomozina
Автор

If anyone else had didn't immediately catch the logic behind the " other = 6 - (start + end) ", it's because if you tally up the values of rods 1, 2, 3 that will equal six. Thus if start = rod 1 and end = rod3, 6-(rod1+rod3) = rod2, thus "other = rod2".

JamesJon
Автор

My jaw literally dropped when I saw that you had 32k subs, I was expecting over 500k!!! But now you're one sub closer!

jonathanhirsch
Автор

Great explanation! Just a suggestion: highlight which line of the code is doing each step as you explain it

igor-ycey
Автор

Im really glad that YouTube finally recommended something that I really needed. Your passion for CS I really resonate with. Amazing video and unparalleled explanation. After encountering recursion, my interest in dynamic programming dwindled quite a lot, but your videos really helped me overcome this hurdle of mine. Many thanks, keep up the amazing work, Here's to hoping for more amazing content Cheers!

mohammedsanaullah
Автор

the effort you put into explaining these complex concepts is unimaginable. I have never seen this kind of presentation for explaining an algorithm. Keep it up please.

pankajbisht
Автор

Thank you for taking the time and effort to make this video. The quality of the editing and animations in the video are excellent and remind me of 3Blue1Brown's videos. Great explanation and it really helped me to visualise and understand how this problem works!

iszaffar
Автор

spent 2 hours last year trying to understand towers of hanoi without any context (just by lloking at code) ...finally gave up and now, after you explained the recursive approach I coded it in python in 10 minutes. just shows what a huge difference a systematic approach can make. your video helped me immensely. thank you

abhirup
Автор

I don't ever take the time to think of such hard problems. But your lessons gives me confidence. Thanks a lot!

puspamadak
Автор

Nobody could have explained it better..genius.The dominos concept is gold!

souravsharma
Автор

I was thinking about this problem a while back, today I got one of your videos recommended to me, and now I'm here! Astounding explanation!

fairextl
Автор

after watching the code part (from 16:00 to 20:00) a couple of times and not understanding a single thing, I wrote the functions on paper and watched again and my mind blew away. Damn you're amazing.

arielcavalcante
Автор

This video is soooo great! It took me awhile, but after repeating your video for 5 times, I finally understand this completely and was able to even work out examples with 5+ discs on my own. Thank you so much!!!

jocelynchang
Автор

A few years ago, I solved the towers of hanoi with a loop.
I assumed, that there are always three rods. And I said, that an empty rod is a very large disc.
I only needed one input: the number of discs. I had realized quite another pattern, for which it is important, whether the number of discs is odd or even.
The pattern is, that every other move is the move of the smallest disc. If the number of discs is odd, it always moves start -> end -> other -> start. If the number of discs is even, it always moves start -> other -> end -> start. The other move is always the smaller of the two discs on top of the bigger disc.

This solution might might have a few memory issues, but it works.

HalfEye
Автор

This is actually an amazing video, with super clear and simple explanations and animations. This is absolutely amazing and mind blows.
Thank you so much

tmorid
Автор

You are the 3blue1brown of computer science. Keep it up!

tlqy
Автор

Mindblowing explanation and animation! That 'Dominos' concept :), I personally liked it!

swapnilnagar