DS-Recursion
This commit is contained in:
9
Recursion/P27_All_Sorted.cpp
Normal file
9
Recursion/P27_All_Sorted.cpp
Normal 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
12
Recursion/P28_19_n!.cpp
Normal 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
BIN
Recursion/P28_19_n!.exe
Normal file
Binary file not shown.
15
Recursion/P28_20_Feb.cpp
Normal file
15
Recursion/P28_20_Feb.cpp
Normal 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
BIN
Recursion/P28_20_Feb.exe
Normal file
Binary file not shown.
14
Recursion/P29_21_ComplexFunc.cpp
Normal file
14
Recursion/P29_21_ComplexFunc.cpp
Normal 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;
|
||||
}
|
BIN
Recursion/P29_21_ComplexFunc.exe
Normal file
BIN
Recursion/P29_21_ComplexFunc.exe
Normal file
Binary file not shown.
6
Recursion/P29_22_Ackermann.cpp
Normal file
6
Recursion/P29_22_Ackermann.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main(){
|
||||
|
||||
return 0;
|
||||
}
|
0
Recursion/Resursion 递归
Normal file
0
Recursion/Resursion 递归
Normal file
0
Recursion/新建 文本文档.txt
Normal file
0
Recursion/新建 文本文档.txt
Normal file
Reference in New Issue
Block a user