python rotated binary search 二分查找
有一道leetcode题,简单点说,就是一个有序序列,随机截成两段,然后这两段交换位置,让你在O(logn)的时间里找一个search一个值,本质上是二分查找的变异
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e.,0 1 2 4 5 6 7might become4 5 6...
原创
2019-04-07 11:21:51 ·
190 阅读 ·
0 评论