Documentation
¶
Overview ¶
Package search is a subpackage dedicated to all searching algorithms related to slices/arrays.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinaryIterative ¶
BinaryIterative Iterative Binary Search
func Interpolation ¶
Interpolation searches for the entity in the given sortedData. if the entity is present, it will return the index of the entity, if not -1 will be returned. see: https://en.wikipedia.org/wiki/Interpolation_search Complexity
Worst: O(N) Average: O(log(log(N)) if the elements are uniformly distributed Best: O(1)
Example
fmt.Println(InterpolationSearch([]int{1, 2, 9, 20, 31, 45, 63, 70, 100},100))
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.