Documentation
¶
Overview ¶
Package array gives all array related functions like search, copy, clone, remove, etc.
Index ¶
- func BiDirectionalSearch[T comparable](elements []T, element T) int
- func BinarySearch[T cmp.Ordered](elements []T, element T) int
- func LinearSearch[T comparable](elements []T, element T) int
- func ReverseLinearSearch[T comparable](elements []T, element T) int
- func ThreadSearch[T comparable](elements []T, element T) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BiDirectionalSearch ¶ added in v0.0.4
func BiDirectionalSearch[T comparable](elements []T, element T) int
This is a simple linear search which search from both side of an array Search for the element in the array and gives the first index of the element otherwise -1
func BinarySearch ¶
Search for the element in the array and gives the first index of the element otherwise -1 .
This is only aplicable if the array is sorted
func LinearSearch ¶
func LinearSearch[T comparable](elements []T, element T) int
Search for the element in the array and gives the first index of the element otherwise -1
func ReverseLinearSearch ¶ added in v0.0.4
func ReverseLinearSearch[T comparable](elements []T, element T) int
This is a reverse linear search algorithm Search for the element in the array and gives the first index of the element otherwise -1
func ThreadSearch ¶ added in v0.0.4
func ThreadSearch[T comparable](elements []T, element T) int
This is an experimental function
Types ¶
This section is empty.