Lesson 9 of 24
RecursionRecursion
10 min 30 XP
Recursion: function தன்னைத்தானே சிறிய input-உடன் அழைக்கும். Base case நிறுத்தும். Tower of Hanoi recursion-ன் புகழ்பெற்ற உதாரணம்: n disks-க்கு 2ⁿ - 1 moves.
In recursion a function calls itself on a smaller input until a base case stops it. The Tower of Hanoi is the classic example: n disks need 2ⁿ - 1 moves.
Example: edit me and press Run
Press Run to see the result here.