https://oj.leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/
http://blog.csdn.net/linhuanmars/article/details/40449299
Public class solution { public int findmin (Int[] num) { // solution a: // return findmin_iteration ( NUM); // Solution b: return findmin_recursion (Num, 0, &NBSP;NUM.LENGTH&NBSP;-&NBSP;1); } //////////////// // Solution A: Iteration // private int findmin_iteration (int[] num) { int lo = 0; int hi = num.length- 1; int mid = 0; while (Lo < hi) { mid = lo + (Hi - lo) / 2; if (num[mid] > num[hi]) { lo = mid + 1; } else if (num[ Mid] < num[hi]) { hi = mid; } else { // when num[mid] and num[hi] are same hi--; } } return num[lo]; } //////////////// // Solution B: Recursion // private int findmin_recursion (int[] N, int low, int high) { if (Low == high) return n[low]; if (LOW&NBSP;+&NBsp;1 == high) return Math.min (N[low], n[high]); int mid = low + (High - low) / 2; if (N[low] < n[mid] && n[low] < n[high]) { Return findmin_recursion (N, low, mid); } else if (n[low] > n[mid] && n[low] > n[high]) { return findmin_recursion (N, low, mid); } else // i don ' t know { Return findmin_recursion (N, low + 1, high); } }}
[leetcode]154 Find Minimum in rotated Sorted Array II