0033_search-in-rotated-sorted-array

command
v0.0.0-...-60194e6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2020 License: Unlicense Imports: 0 Imported by: 0

README

0033_search-in-rotated-sorted-array

要求用O(logN)的时间在数组内找到某个元素的位置.

这个数组是经过一个严格递增, 即没有重复元素的数组进行pivot未知的rotate之后的得来的.

[0,1,2, | 4,5,6,7] -> [4,5,6,7, | 0,1,2]
      pivot                   pivot

若是没有进行rotate, 我们可以用二分法查找元素.

现在用"三分法"查找.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL