fork download
  1. #include <iostream>
  2. using namespace std;
  3. void rotat(int a[], int l, int r)
  4. {
  5. if(l>r) {
  6. cout<<"no element";
  7. return;}
  8. int mid=(l+r)/2;
  9. if(mid>0 && a[mid]<a[mid-1]) {
  10. cout<<mid<<" ";}
  11. else if(a[l]<a[mid])
  12.  
  13. {
  14. rotat(a, mid+1, r) ;
  15.  
  16. }
  17. else{
  18. rotat(a,l, mid-1) ;
  19. }
  20. }
  21. int main() {
  22. int a[15]={67,77,88,99,112,11,17,19,22,33,37,40,44,55,66};
  23. rotat(a,0,14);
  24. return 0;
  25. }
Success #stdin #stdout 0s 5492KB
stdin
Standard input is empty
stdout
5