algo_basic

package
v0.0.0-...-e19c9e5 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinarySearch

func BinarySearch(arr []int, l, r, value int) int

BinarySearch must be sorted Arr else Meaningless but the algo is not accurate when the same element occurs over twice times.

func CharToInt

func CharToInt(char rune) int

func IntToChar

func IntToChar(intNum int) interface{}

func IntToStr

func IntToStr(intValue int) string

func LowerBound

func LowerBound(arr []int, l, r, value int) int

LowerBound from l find the first arr[i] <= value example. {10,10,20,20,20,20,30,30},0,7,20 return index is 2 algo complex is O(log(r-l))

func MaxValue

func MaxValue(compValue, compedValue int) int

func MinValue

func MinValue(compValue, compedValue int) int

func MyAbs

func MyAbs(value int) int

func StrToInt

func StrToInt(str string) int

func UpperBound

func UpperBound(arr []int, l, r, value int) int

UpperBound from r find the first arr[i] > value example. {10,10,20,20,20,20,30,30},0,7,20 return index is 6 algo complex is O(log(r-l))

Types

type MySort

type MySort struct {
	IsAsc bool
}

func (*MySort) MyMergeSort

func (mySort *MySort) MyMergeSort(arr []int, l, r int) [][]int

func (*MySort) MyQuickSort

func (mySort *MySort) MyQuickSort(arr []int, l, r int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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