array

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package array gives all array related functions like search, copy, clone, remove, etc.

Index

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

func BinarySearch[T cmp.Ordered](elements []T, element T) int

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.

Jump to

Keyboard shortcuts

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