Skip to content

Commit c94c9fc

Browse files
committed
Structured the repository
1 parent 565b5d3 commit c94c9fc

File tree

149 files changed

+41
-443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+41
-443
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include<bits/stdc++.h>
2+
3+
using namespace std;
4+
5+
int LUP[10000];
6+
7+
int fib(int n){
8+
if(n==0)
9+
return 0;
10+
if(n==1){
11+
LUP[1]=1;
12+
return 1;
13+
}
14+
15+
if(LUP[n]!=0)
16+
return LUP[n];
17+
else if(n == 2){
18+
LUP[n-1] = n - 1;
19+
return n - 1;
20+
}
21+
LUP[n] = fib(n - 1) + fib(n - 2);
22+
return LUP[n];
23+
}
24+
25+
int main(){
26+
int i, n;
27+
for(i = 0; i < 10000; i++)
28+
LUP[i]=0;
29+
cin >> n;
30+
cout << fib(n);
31+
return 0;
32+
}

Algorithms/Dynamic Programming/fibmemo.cpp

Lines changed: 0 additions & 31 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)