Lesson 15 of 23
Recursion
10 min 30 XP
Recursive function ছোট input দিয়ে নিজেকেই call করে। Base case না থাকলে stack overflow হয় এবং প্রোগ্রাম crash করে।
Example: edit me and press Run
Output Loading C (first time takes a few seconds)
Press Run to see the result here.Recursive fib(40) খুব ধীর (O(2ⁿ)); loop বা memoization একে O(n) করে। Interviewer-রা এই তুলনা খুব পছন্দ করেন।