title: Find the maximum element in an array which is first increasing and then decreasing
body: <p>I made a code and compiled for below input it is correct 
   as</p>
  
  <pre><code> Input: arr[] = {8, 10, 20, 80, 100, 200, 400, 500, 3, 2, 1}
  </code></pre>
  
  <p>Output: 500</p>
  
  <pre><code> Input: arr[] = {1, 3, 50, 10, 9, 7, 6}
  </code></pre>
  
  <p>Output: 50</p>
  
  <pre><code>int findIncre_Decre(int arr[], int low, int high)
    {
          if (low == high)
          return arr[low];
  
         /* If there are two elements and first is greater then
            the first element is maximum */
           if ((high == low + 1) &amp;&amp; arr[low] &gt;= arr[high])
                  return arr[low];
  
           /* If there are two elements and second is greater then
               the second element is maximum */
               if ((high == low + 1) &amp;&amp; arr[low] &lt; arr[high])
                   return arr[high];
  
                 int mid = (low + high)/2; /*low + (high - low)/2;*/
  
            /* If we reach a point where arr[mid] is greater than both of
             its adjacent elements arr[mid-1] and arr[mid+1], then arr[mid]
              is the maximum element*/
         if ( arr[mid] &gt; arr[mid + 1] &amp;&amp; arr[mid] &gt; arr[mid - 1])
              return arr[mid];
  
         if (arr[mid] &gt; arr[mid + 1] &amp;&amp; arr[mid] &lt; arr[mid - 1])
           return findIncre_Decre(arr, low, mid-1);
           else 
          return findIncre_Decre(arr, mid + 1, high);
     }
  </code></pre>
  
  <p>But it is not working for </p>
  
  <p>Input:- </p>
  
  <pre><code>arr[]={7,8,9,10,15,5,16}
  </code></pre>
  
  <p>Expected Output:- </p>
  
  <pre><code>15 
  </code></pre>
  
  <p>But I got answer 16 instead of 15.</p>
  
  <p>Any idea will be appreciated.</p>
  
  <p>Thanks in advance.</p>