binarySearch

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinarySearch

func BinarySearch[T cmp.Ordered](array []T, target T) int

Binary Search is a search algorithm that finds the position of a target value in a sorted array.

func BinarySearchFunc

func BinarySearchFunc[T any](array []T, target T, compare func(lhs, rhs T) int) int

Binary Search is a search algorithm that finds the position of a target value in a sorted array. This function accepts any type of arguments, but a user should provide compare function. Compare function returns: 0 if two arguments are equal +1 if the left argument is greater -1 if the right argument is greater

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL