title: algorithm to find max and min in a increasing,decreasing, increasing and decreasing array
body: <p>Given an array , in which either the values are only increasing or only decreasing or increasing and then decreasing, How to find the max and min value of such and array?</p>
  
  <p>min value is nothing but the smallest of the end values.</p>
  
  <p>but how to find max value?</p>
  
  <p>One way is the linear approach with running time of O(n), can this be solved in O(logn), using some modification to the binary search? </p>
  
  <p>Any code (in java) is highly appreciated.</p>
  
  <p>Thanks
  <br>
  Nohsib</p>