sortfunctions

package
v0.0.0-...-c4ba0da Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayCopy

func ArrayCopy(arrsrc []interface{}, lowsrc int, arrdest []interface{}, lowdest, size int)

Copy a elements (size) from array 1 to array 2

func EvaluateMin

func EvaluateMin(a, b interface{}, comp goutils.TypeComparator) interface{}

return min between a, b

func FindMaxMinElementIndex

func FindMaxMinElementIndex(arr []interface{}, comp goutils.TypeComparator, low, high int) (interface{}, interface{})

Returns the max_min element in arr[0..size-1]

func GetMaxIndex

func GetMaxIndex(arr []interface{}, comp goutils.TypeComparator, i, j int) int

Return max index

func GetMinIndex

func GetMinIndex(arr []interface{}, comp goutils.TypeComparator, i, j int) int

Return min index

func HighestPowerofTwoLessThan

func HighestPowerofTwoLessThan(n int) int

return the highest number less than N that is power of 2

func IsPowerOfTwo

func IsPowerOfTwo(x int) (bool, int)

return True if is power of 2

func IsSorted

func IsSorted(arr []interface{}, comp goutils.TypeComparator, low, high int) bool

verify is Sorted

func Permute

func Permute(arr []interface{}, comp goutils.TypeComparator, low, high int)

Generate permutation in the array

func Reverse

func Reverse(arr []interface{}, low, high int)

Reverses arr[low..high]

func SetPowerOfTwo

func SetPowerOfTwo(x uint) int

Power Two

func Shuffle

func Shuffle(arr []interface{}, comp goutils.TypeComparator, low, high int)

Generate random permutation in the array

Types

This section is empty.

Jump to

Keyboard shortcuts

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