title: C# calculate function min per given range
body: <p>I need to find the minimum from a given range without running O(n).</p>
  
  <p>The array might be a some diagonal line or a hyperbole. here are three sample arrays:</p>
  
  <pre><code>var arrDiag1 = new double[10] { 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5 };
  var arrDiag2 = new double[10] { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
  var arrHyperbole = new double[10] { 9, 8, 7, 6, 5, 4, 3, 4, 5, 6 };
  </code></pre>
  
  <p>I tried building some sort of calculation from the line in the desert exercise but it came out no good.
  Anyone has a better idea?</p>
  
  <p>Thanks for the help</p>
  
  <p><strong>update</strong></p>
  
  <p>With dasblinkenlight help I managed to get to this method:</p>
  
  <pre><code>    private double BinarySearchMin(double[] arr, int left, int leftMiddle, int rightMiddle, int right)
      {
          if (left == right)
              return arr[left];
  
          if (arr[leftMiddle] &lt; arr[rightMiddle])
          {
              right = rightMiddle;
              leftMiddle = ((right - left) / 3);
              rightMiddle = ((right - left) / 3 * 2);
              return BinarySearchMin(arr, left, leftMiddle, rightMiddle, right);
          }
          if (arr[leftMiddle] &gt; arr[rightMiddle])
          {
              left = leftMiddle;
              leftMiddle = ((right - left) / 3) + left;
              rightMiddle = ((right - left) / 3 * 2) + left;
              return BinarySearchMin(arr, left, leftMiddle, rightMiddle, right);
          }
          if (arr[leftMiddle] == arr[rightMiddle])
          {
              left = leftMiddle;
              right = rightMiddle;
              leftMiddle = ((right - left) / 3) + left;
              rightMiddle = ((right - left) / 3 * 2) + left;
              return BinarySearchMin(arr, left, leftMiddle, rightMiddle, right);
          }
          return -1;
      }
  </code></pre>
  
  <p>In the first array it works but not in the second and third arrays.
  What am I missing here?</p>