DS-Recursion

This commit is contained in:
e2hang
2025-07-17 15:30:55 +08:00
parent dd0d210e84
commit 2ed81d2e89
10 changed files with 56 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
//For a,b,c we have sort abc acb bac bca cab cba(6 kinds) This Program is to sort all of the kinds
#include <iostream>
using namespace std;
int main() {
return 0;
}

12
Recursion/P28_19_n!.cpp Normal file
View File

@@ -0,0 +1,12 @@
#include <iostream>
using namespace std;
int jc(int n){
if(n > 0)
return jc(n - 1)*n;
return 1;
}
int main(){
cout << jc(10) << endl;
return 0;
}

BIN
Recursion/P28_19_n!.exe Normal file

Binary file not shown.

15
Recursion/P28_20_Feb.cpp Normal file
View File

@@ -0,0 +1,15 @@
#include <iostream>
using namespace std;
int feb(int n){
if(n > 1)
return feb(n - 1) + feb(n - 2);
return 1;
}
int main(){
for(int i = 1;i < 10; i++){
cout << feb(i) << endl;
}
return 0;
}

BIN
Recursion/P28_20_Feb.exe Normal file

Binary file not shown.

View File

@@ -0,0 +1,14 @@
#include <iostream>
using namespace std;
int cf(int n){
if(n%2 == 1)
return cf(3*n + 1);
if(n%2 == 0)
return n / 2;
}
int main(){
cout << cf(5) << " "<< cf(6) << " " << cf(7) << endl;
return 0;
}

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#include <iostream>
using namespace std;
int main(){
return 0;
}

View File

View File