Documentation ¶
Overview ¶
This code is implemented by referring to https://github.com/UWHustle/Efficiently-Searching-In-Memory-Sorted-Arrays.
Index ¶
- func BinarySearchByKey(a []byte, sz int, compFunc func(x []byte) int) (int, int)
- func InterpolationSearchByOffset(a []byte, sz int32, offset int32) (int, int)
- func LowerBoundInt64Ascending(a []int64, x int64) int
- func LowerBoundInt64Descending(a []int64, x int64) int
- func SIPSearchByKey(a []byte, is *ISSet, sz int, x []byte, value int, compFu func(x []byte) int, ...) (int, int, int)
- func TIPSearchByKey(a []byte, ts *TSSet, sz int, value int, compFu func(x []byte) int, ...) (int, int, int)
- func UpperBoundInt64Ascending(a []int64, x int64) int
- func UpperBoundInt64Descending(a []int64, x int64) int
- type ISSet
- type TSSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinarySearchByKey ¶
func LowerBoundInt64Ascending ¶
LowerBoundInt64 looks for the first element sorted in ascending order that is smaller than the target value. return the index of that element if it exists, otherwise return -1.
func LowerBoundInt64Descending ¶
LowerBoundInt64Descending looks for the first element sorted in descending order that is smaller than the target value. return the index of that element if it exists, otherwise return -1.
func SIPSearchByKey ¶
func TIPSearchByKey ¶
func UpperBoundInt64Ascending ¶
UpperBoundInt64 looks for the first element sorted in ascending order that is greater than or equal to the target value. return the index of that element if it exists, otherwise return -1.
func UpperBoundInt64Descending ¶
LowerBoundInt64Descending looks for the first element sorted in descending order that is greater than or equal to the target value. return the index of that element if it exists, otherwise return -1.