title: k-rotated-shifted array and finding x?
body: <p>We say a <code>k-rotated-shifted array</code>, to an array such that with k rotate can be sorted.  Example is : <code>A=[10, 15, 20, 1, 7]</code>, with <code>k=2</code>. I propose an algorithm for finding a key like <code>x</code> in this k-rotated-shifted array.</p>
  
  <p>anyone could help me to verify it?</p>
  
  <p><img src="https://i.stack.imgur.com/fOLak.jpg" alt="enter image description here"></p>
  
  <p>Edit 1: my new code is:</p>
  
  <pre><code> int S(int l, int r, int x)
  { int f=A[l], m=A[(l+r)/2], la=A[l];
  if (x==f or x==m or x==la)
       return 1;
  else {if ((x&lt; f and x&gt;m) || (x&gt;f and x&gt;m) || (x&lt;f and x&lt;m))
     return S((l+r)/2, r, x);
     else
      return S(l,(l+r)/2, x);
  }
  }
  </code></pre>