chapter10

package
v0.0.0-...-45e99ae Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDuplicates

func GetDuplicates(array []int) (result []int)

GetDuplicates returns the duplicates in array

func GroupAnagrams

func GroupAnagrams(array []string)

GroupAnagrams groups anagrams in an array in place.

func MergeSort

func MergeSort(items []int)

MergeSort sorts an item recursively using the mergesort algorithm

func MergeSorted

func MergeSorted(a, b []int, lastA, lastB int)

MergeSorted merges 2 sorted arrays into the first array.

func SearchListy

func SearchListy(list Listy, value int) int

SearchListy searches a a listy for a value

func SearchRotatedArray

func SearchRotatedArray(array []int, x int) int

SearchRotatedArray searches a rotated array for value X

func SearchStringExcludingEmpty

func SearchStringExcludingEmpty(strings []string, str string) (index int)

SearchStringExcludingEmpty searches for a string excluding the empty string

func SortPeakValley

func SortPeakValley(array []int)

SortPeakValley sorts an array into peaks and valleys

func SwapArray

func SwapArray(array []int, i, j int)

SwapArray swaps an array without using a 3rd integer

Types

type BitSet

type BitSet struct {
	BitSet []int
}

BitSet is a set of bits

func NewBitSet

func NewBitSet(size int) BitSet

NewBitSet creates a new bit set

type Listy

type Listy map[int]int

Listy is an array like datatype which returns -1 if an element doesn't exist

type MatrixCoordinate

type MatrixCoordinate struct {
	// contains filtered or unexported fields
}

MatrixCoordinate represents teh coordinates of a matrix

func FindElementInSortedMatrix

func FindElementInSortedMatrix(matrix [][]int, x int) *MatrixCoordinate

FindElementInSortedMatrix finds x in a matrix that is sorted by both row and column

func NewMatrixCoordinate

func NewMatrixCoordinate(row, col int) MatrixCoordinate

NewMatrixCoordinate creates a new coordinate

type RankNode

type RankNode struct {
	// contains filtered or unexported fields
}

RankNode is a data structure for left size aware binary search tree

func NewRankNode

func NewRankNode(data int) *RankNode

NewRankNode creates a new tree node

Jump to

Keyboard shortcuts

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