algorithms

package
v1.21.11 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 2 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BiSearch

func BiSearch[ValueType NumberType, T Element[ValueType]](sElement []T, value ValueType, matchUp int) int

BiSearch 二分查找,切片必需有序 matchUp规则如下: 参数为0时,则一定要找到相等的值 参数-1时,找value左边的值,例如:[10,20,30,40],当value为9时返回-1; 当value为11时,返回0 当value为41时,返回 3 参数 1时,找value右边的值,例如:[10,20,30,40],当value为9时返回 0; 当value为11时,返回1 当value为41时,返回-1

返回-1时代表没有找到下标

func ClearBitwiseTag added in v1.18.6

func ClearBitwiseTag[Number BitNumber, UNumber UnsignedNumber](bitBuff []Number, bitPositionIndex UNumber) bool

func GetBitwiseNum added in v1.18.6

func GetBitwiseNum[Number BitNumber](bitBuff []Number) int

func GetBitwiseTag added in v1.18.6

func GetBitwiseTag[Number BitNumber, UNumber UnsignedNumber](bitBuff []Number, bitPositionIndex UNumber) (bool, error)

func SetBitwiseTag added in v1.18.6

func SetBitwiseTag[Number BitNumber, UNumber UnsignedNumber](bitBuff []Number, bitPositionIndex UNumber) bool

Types

type BitNumber added in v1.18.6

type BitNumber interface {
	int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | uintptr
}

type Element

type Element[ValueType NumberType] interface {
	GetValue() ValueType
}

type NumberType

type NumberType interface {
	int | int8 | int16 | int32 | int64 | string | float32 | float64 | uint | uint8 | uint16 | uint32 | uint64
}

type UnsignedNumber added in v1.18.6

type UnsignedNumber interface {
	uint | uint8 | uint16 | uint32 | uint64 | uintptr
}

Directories

Path Synopsis
Package skip defines a skiplist datastructure.
Package skip defines a skiplist datastructure.

Jump to

Keyboard shortcuts

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