| by Kenneth Chase | 30 comments

Dynamic Programming | Set 1 (Overlapping Subproblems Property) | GeeksforGeeks


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

30 Comments

Rekha Tokas

Oct 10, 2016, 1:52 pm Reply

Very well explained .

rohit sancheti

Nov 11, 2016, 7:35 am Reply

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

Osman Tursun

Dec 12, 2016, 11:05 am Reply

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

Yuding Chow

Mar 3, 2017, 12:39 pm Reply

StackOverFlowException 🙁

Siva R

Mar 3, 2017, 3:31 pm Reply

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

Aaish Sindwani

May 5, 2017, 10:51 am Reply

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 !

May 5, 2017, 7:50 pm Reply

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

Jun 6, 2017, 4:16 am Reply

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

Vasu Chitti

Jul 7, 2017, 1:49 pm Reply

helped me a lot.

Marcos 5

Jul 7, 2017, 3:34 pm Reply

awesome!

Vineet Kothari

Jul 7, 2017, 12:56 pm Reply

nice

Abhilash Patel

Jul 7, 2017, 6:14 pm Reply

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

MAHTAB ALAM

Jul 7, 2017, 2:17 pm Reply

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

Md Affan

Aug 8, 2017, 1:26 pm Reply

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

Ram

Oct 10, 2017, 2:49 pm Reply

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

mohan krishna

Nov 11, 2017, 10:36 am Reply

what is difference between big O and small o

Nick Lordi

Nov 11, 2017, 5:13 am Reply

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

Vijai Murugan

Dec 12, 2017, 6:28 pm Reply

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

southrodney

Jan 1, 2018, 1:45 pm Reply

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

Peter Benc

Jan 1, 2018, 7:29 pm Reply

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

Amit Singh

Jan 1, 2018, 4:27 pm Reply

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

Feb 2, 2018, 4:50 pm Reply

Who disliked this video?

kokoinmars

Feb 2, 2018, 5:19 pm Reply

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

Ankit Yadav

Mar 3, 2018, 7:05 pm Reply

102334155

Mus Alhilo

Oct 10, 2018, 5:48 pm Reply

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

sandeep jaisawal

Jan 1, 2019, 12:52 pm Reply

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

Aman kumar

Aug 8, 2019, 7:58 am Reply

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

Aug 8, 2019, 7:24 pm Reply

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

Vishal Kumar Saini

Sep 9, 2019, 11:36 am Reply

Sar pass hona Ka re bato

Guangwei Zhang

Sep 9, 2019, 10:08 am Reply

thanks a lot

Leave a Reply