chapter8

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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountEval

func CountEval(input string, result bool) int

CountEval the number of parenthesis required to evaluate a string. TODO: Fix algorithm

func GenerateAllValidParens

func GenerateAllValidParens(count int) []string

GenerateAllValidParens generates all valid parenthesis having count.

func GetPermutations

func GetPermutations(str string) (result []string)

GetPermutations returns all permutations of a string

func GetPermutationsWithDuplicates

func GetPermutationsWithDuplicates(s string) []string

GetPermutationsWithDuplicates returns all permutations of a string without duplicates.

func GetPowerSet

func GetPowerSet(set []int) [][]int

func MagicBinarySearch

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

func MagicFirstBruteForce

func MagicFirstBruteForce(array []int) (i int)

func MakeChange

func MakeChange(n int) (result int)

MakeChange returns the amount of combinations of quaters, nikels, dimes and ones needed to make n

func MaxStackHeight

func MaxStackHeight(boxes []Box) int

MaxStackHeight calculates the maximum height that can be archived by stacking an array of boxes

func NotIn

func NotIn(haystack []Point, needle Point) bool

func PaintFill

func PaintFill(screen [][]Color, r, c int, nColor Color) bool

PaintFill paints radially outwards

func PlaceNQueens

func PlaceNQueens(queens int) int

PlaceNQueens returns the number of ways of placing n queens in an n x n grid

func RecursiveMultiply

func RecursiveMultiply(n, m int) int

func SolveForN3

func SolveForN3()

func TripleStep

func TripleStep(n int) (result int)

func TripleStepRecursive

func TripleStepRecursive(n int) (result int)

Types

type Box

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

Box is a box with height, width and depth dimensions

type Color

type Color string

Color represents a color

type Point

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

func GetPath

func GetPath(maze [][]int) (path []Point)

type Tower

type Tower struct {
	Disks *list.List
	Index int
}

func NewTower

func NewTower(index int) *Tower

func (*Tower) Add

func (tower *Tower) Add(d int) error

func (*Tower) MoveDisks

func (tower *Tower) MoveDisks(n int, destination *Tower, buffer *Tower)

func (*Tower) MoveTopTo

func (tower *Tower) MoveTopTo(t *Tower)

Jump to

Keyboard shortcuts

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