algorithms

package
v0.0.0-...-01c468f Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs[T constraints.Signed | constraints.Float](a T) T

Abs is a generic function that returns the absolute value of a signed or floating-point number.

func Floor

func Floor[T constraints.Float](a T) T

Floor is a generic function that rounds down a floating-point value to the nearest integer.

func GeneratePermutations

func GeneratePermutations(elems []int) [][2]int

GeneratePermutations is a function that generates permutations of length 2 for the input slice

func LowerBound

func LowerBound[T constraints.Ordered](array []T, target T) (int, error)

LowerBound is a generic function that performs a lower bound search on a sorted array. It searches for the first element in the array that is greater than or equal to the target value. The function takes in a sorted array and the target value as parameters and returns the index of the found element. If the target value is greater than all elements in the array, an error is returned.

func Max

func Max[T constraints.Ordered](a, b T) T

Max is a generic function that returns the maximum value between two ordered elements.

func ToBoolArray

func ToBoolArray(in byte) [8]bool

ToBoolArray converts single byte into array of booleans. Significance of bits in resulting array is in a descending order.

Types

This section is empty.

Jump to

Keyboard shortcuts

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