Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Combination
//clang 3.8.0 #include <iostream> void combinationUtil(int arr[],int choose[],int r,int size); bool recursivViceCombination(int arr[],int choose[],int index,int start,int size,int r); int main() { std::cout << "Hello, world!\n"; int r =2; int arr[]={1,2,3,4}; int choose[r]; int size= sizeof(arr)/sizeof(arr[0]); combinationUtil(arr,choose,r,size); } void combinationUtil(int arr[],int choose[],int r,int size){ recursivViceCombination(arr,choose,0,0,size,r); } bool recursivViceCombination(int arr[],int choose[],int index,int start,int end,int r){ if(index == r){ for(int i=0;i<r;i++){ std::cout<<arr[choose[i]]; } std::cout<<std::endl; return false; } for(int i=start;i<end;i++) { choose[index]=i; recursivViceCombination(arr,choose,index+1,i,end,r); } return true; }
run
|
edit
|
history
|
help
0
INHERIT_CTORS default constructor
Non type template argument
Uno
GraphBase
cv5_class
user defined exception
Dequeue Array-Based Example
Rounding float to nearest 1000
isnan_constexpr
Uno v2