Find the max and min of an increasing then decreasing list
I've tried googling for this one without much success...I'm sure there's a technical name for this problem or for problems like it, but I can't seem to find the answer.

Given a list `L` of integers, that is strictly increasing, and then strictly decreasing, find the maximum and minimum of that list.

So for example, `L` might be `{1 2 3 4 5 4 3 2}` or `{2 4 5 7 3}`.  

For finding the minimum, I said that the smallest integer had to either be the left or the right endpoint, so just compare the endpoints, and return the smallest one, giving constant time.

For finding the maximum, I suggested basically a recursive binary search to find the point `L[x]` such that `L[x] > L[x-1]` and `L[x] > L[x+1]`, giving amortized lg(n) time.  He didn't seem to love that answer, and it does seem rather naive to me, so I'm wondering if there's something I'm missing.

Thanks for the help!


            
Find the max and min of an increasing then decreasing list
===

I've tried googling for this one without much success...I'm sure there's a technical name for this problem or for problems like it, but I can't seem to find the answer.

Given a list `L` of integers, that is strictly increasing, and then strictly decreasing, find the maximum and minimum of that list.

So for example, `L` might be `{1 2 3 4 5 4 3 2}` or `{2 4 5 7 3}`.  

For finding the minimum, I said that the smallest integer had to either be the left or the right endpoint, so just compare the endpoints, and return the smallest one, giving constant time.

For finding the maximum, I suggested basically a recursive binary search to find the point `L[x]` such that `L[x] > L[x-1]` and `L[x] > L[x+1]`, giving amortized lg(n) time.  He didn't seem to love that answer, and it does seem rather naive to me, so I'm wondering if there's something I'm missing.

Thanks for the help!


            