Skip to content

Glossary: Data Structures and Algorithms in Go

sort.Search

Also written: sort.SearchInts, sort.SearchFloat64s, sort.SearchStrings

Binary-search helpers in the `sort` package. `sort.Search(n, f)` returns the first index where `f` becomes true, and `SearchInts` returns the index where a value would go in a sorted slice.

Where the book teaches it

Related terms

Binary searchslices package