Grokking the Art of Recursion for Coding Interviews
Vote

0% completed

Recursive Algorithm Strategies

Recursion involves solving a problem by breaking it down into smaller and simpler instances of the same problem. Before you start designing a recursive algorithm for a problem, you must be clear on the following:

  1. What and how to divide?
  2. What and how to combine sub-problems to solve the bigger ones?
  3. During computation, if the algorithm encounters a similar sub-problem again, will the algorithm solve it again?

The recursive algorithm strategies are classic frameworks that can help you find answers to the above questions.

.....

.....

.....

Like the course? Get enrolled and start learning!
Siddharth Pharate

Siddharth Pharate

· 2 years ago

There is an extra space in the word

techn ique

Caio Cutrim

Caio Cutrim

· 2 years ago

// Function to compute the nth Fibonacci number function fibonacci(n) { // Create a table to store Fibonacci numbers let fibTable = new Array(n+1).fill(0); // Base cases fibTable[0] = 0; fibTable[1] = 1; // Fill fibTable in bottom-up manner for(let i = 2; i <= n; i++) { fibTable[i] = fibTable[i-1] + fibTable[i-2]; } // Return nth Fibonacci number return fibTable[n]; } let n = 13; console.log("Fibonacci number of " + n + " is " + fibonacci(n));