 Hi Guys! Welcome to GeeksforGeeks. In this video, we’ll talk about Dynamic
Programming. But, before we start, let’s first cover
some mathematical background. Consider the following function written on
the screen. We have, f(n) equals f(n-1) + f(n-2), where
n>=2. This function gives us a series of numbers
called the Fibonacci series. So, what’s special about the Fibonacci series? Well, what’s special is that it has a simple
recursive definition. As you can see, the Fibonacci series is defined
as a series of numbers in which each number is given by the sum of the two preceding numbers. For example, we get f(2) by adding f(0) and
f(1), we get f(3) by adding f(1) and f(2) and so on. Now, that we know the recursive definition
of Fibonacci numbers, we can easily write a recursive function that helps us calculate
the Fibonacci numbers. As you can see, the function fib() takes an
integer argument n. First, we check whether n

• ### Rekha Tokas

Very well explained .

• ### rohit sancheti

upload more videos for DP.. its a big help.. thanks in Advance!!

• ### Osman Tursun

why it is intuitively @3:01? is there a very simple method? or you just know the formula?

• ### Yuding Chow

StackOverFlowException 🙁

• ### Siva R

Good explanation…..good u started videos also….

• ### Aaish Sindwani

for a problem to be solved using dp, do we need both optimal substructure and overlapping subproblems to be satisfied by the problem or any one condition makes it eligible for dp

• ### Just the thing u wanted !

Thank GG.
Nice video it is.
I did the computation of 40th fib.no. using codeblocks and i got the correct answer in 1.081seconds using recursion.

• ### Sona Barman

sometimes books doesn't help much to understand difficult topics but this video help much to understand dynamic programming.

• ### Vasu Chitti

helped me a lot.

• ### Marcos 5

awesome!

• ### Vineet Kothari

nice

• ### Abhilash Patel

The 40th one is 63245986 starting from 0 at 1st position.

• ### MAHTAB ALAM

good explanation….upload more videos on dp…it helps alot..

• ### Md Affan

I think u are too fast..Looks like u are in so much hurry

• ### Ram

How you pronounced o(1) o(2^n) can tell me again

• ### mohan krishna

what is difference between big O and small o

• ### Nick Lordi

This is actually great, thanks. (PS get a better microphone!)

• ### Vijai Murugan

www.hackerrank.com/coding-21
Just give a try

• ### southrodney

it's FIB O NA CHI. cc in Italian makes the "ch" sound

• ### Peter Benc

geeksforgeeks has seemed like really decent utube channel, then this video started….c'mon, buy some normal microphone m8 😀

• ### Amit Singh

is the base condition in recursive fib() function correct? i feel it should be if( i==1 || i==2 ) return 1;

• ### Carl's On Carlson

Who disliked this video?

• ### kokoinmars

Wall time in jupyter: 29.4 secs, 533 microseconds, 0 nanoseconds. This was pretty cool! 🙂

• 102334155

• ### Mus Alhilo

what is the functions used to calculate the time like this in python 3.6? for this algo for example

• ### sandeep jaisawal

Your videos are suberrb but why the audio quality is so so so bad like old Radio player

• ### Aman kumar

Solution to Excercise:- (Java Implementation):- public class Main{

public static void main (String[] args) {

int n=39;
System.out.println("The fibonacci series till number "+n+" is:- ");
System.out.print(fib(n));

}

public static int fib(int num){
int res=0;

if(num<=1)
res=1;
else
res=fib(num-1)+fib(num-2);

return res;
}

}

• ### Ramakant Soni

I don't know but recursion is also taking .71 seconds . You can better check https://ide.geeksforgeeks.org/HhIDrFymBx

• ### Vishal Kumar Saini

Sar pass hona Ka re bato

• thanks a lot