SHARE
TWEET

ASD Pb 10 ordonare tablou recursiv

madalinaradu May 26th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int v[10]={0,2,3,4,5,6};
  5.     int s=0;
  6.     int d=5;
  7. int ordon(int v[], int s, int d){
  8.     if(s==d) return 1;
  9.     else
  10.         if(ordon(v,s,(s+d)/2) && ordon(v,(s+d)/2+1, d) && v[(s+d)/2]<=v[(s+d)/2+1])
  11.             return 1;
  12.         else
  13.             return 0;
  14. }
  15.  
  16. int main(){
  17.  
  18.     cout<<ordon(v,0,5)<<" ";
  19.     return 0;
  20.  
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top