Advertisement
apl-mhd

array suffle n<->n+1

Mar 12th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. using namespace std;
  4.  
  5.  
  6. void suffle(int a[], int start, int end, int n){
  7.  
  8.     int mid = (start + end) /2;
  9.  
  10.     if(start != end){
  11.  
  12.  
  13.         suffle(a,start, mid, n);
  14.         suffle(a,mid+1, end,n);
  15.         if(!(start ==0 && end ==n) )
  16.         cout<<"("<<a[start+1]<<")"<<":"<<"("<<a[start]<<")";
  17.  
  18.     }
  19.  
  20.  
  21. }
  22.  
  23. int main() {
  24.  
  25.  
  26.     int a[] = {1,2,3,4};
  27.  
  28.     suffle(a, 0, 3,3);
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement