Finding the Critical Point in a Mountain or Valley-Shaped Array