https://github.com/pumpkinseed/mobise
Find minimum element in rotated sorted array – Modified binary search
https://github.com/pumpkinseed/mobise
Last synced: 6 months ago
JSON representation
Find minimum element in rotated sorted array – Modified binary search
- Host: GitHub
- URL: https://github.com/pumpkinseed/mobise
- Owner: PumpkinSeed
- Created: 2018-06-12T08:12:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-12T09:05:21.000Z (over 7 years ago)
- Last Synced: 2025-04-14T13:16:17.371Z (6 months ago)
- Language: Go
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Modified binary search
Based on the [article](https://confusedcoders.com/data-structures/find-minimum-element-in-rotated-sorted-array-modified-binary-search).
## Usage
```
var arr = []int{7, 8, 9, 10, 11, 13, 24, 1, 2, 3, 4, 5, 6}value := Search(arr, 0, len(arr)-1)
// value == 7
// arr[value] == 1
```### Benchmark
```
Number of elements: 13055
BenchmarkSearch-4
20000000 70.0 ns/op
```