Find Minimum in Rotated Sorted Array II

Follow up for "Find Minimum in Rotated Sorted Array":

What if duplicates are allowed?
Would this affect the run-time complexity? How and why?

When num[mid] == num[tail], we need to linearly move the pointer. The worst case complexity is O(n), but the average will still be better than simple linear search.

Comments

Popular posts from this blog

Maximum Gap

[ITint5] Maximum Subarray for a Circular Array

[CC150] Chapter 4 Trees and Graphs