Documentation ¶
Index ¶
- Variables
- func ExecutePerLine(r io.Reader, f func(line string) error)
- func IntSliceSum(s []int) int
- func LeastCommonMultiple(nums []int) int
- func NevilleInterpolation(xs []int, ys []int, x int) int
- func PrimeFactorization(num int) []int
- func ReadFile(name string) *os.File
- func SliceFilter[T any](s []T, f func(v T) bool) []T
- func SliceMap[T any, U any](s []T, f func(v T) U) []U
- func StrSliceToIntSlice(strs []string) ([]int, error)
- type Char
- type ConnectionMap
- func (cMap ConnectionMap[K]) Betweeness() map[K]float64
- func (cMap ConnectionMap[K]) Dijkstra(source K) (map[K]int, map[K]K)
- func (cMap ConnectionMap[K]) DijkstraWithDest(source K, destination K) int
- func (cMap ConnectionMap[K]) EdgeBetweeness() map[K]map[K]float64
- func (cMap ConnectionMap[K]) LongestDijkstraWithDest(source K, destination K) (int, []K)
- type Coordinate
- type Coordinate3D
- type Direction
- type Number
- type PriorityQueue
- func (pq *PriorityQueue[K, P]) Init(vals map[K]P)
- func (pq *PriorityQueue[_, _]) Len() int
- func (pq *PriorityQueue[K, P]) Pop() (K, P)
- func (pq *PriorityQueue[K, P]) Push(v K, priority P)
- func (pq *PriorityQueue[K, P]) SetPriorityOrder(inverseOrder bool)
- func (pq *PriorityQueue[K, P]) Update(v K, priority P)
- type Queue
- type Stack
Constants ¶
This section is empty.
Variables ¶
View Source
var ( UP = Direction(NewCoordinate(0, -1)) DOWN = Direction(NewCoordinate(0, 1)) LEFT = Direction(NewCoordinate(-1, 0)) RIGHT = Direction(NewCoordinate(1, 0)) )
View Source
var (
ErrKeyAlreadyExists = errors.New("key already exists")
)
Functions ¶
func IntSliceSum ¶
func LeastCommonMultiple ¶
func PrimeFactorization ¶
func SliceFilter ¶
func StrSliceToIntSlice ¶
Types ¶
type Char ¶
type Char rune
Char is just a rune that implements Stringer so that printing out runes is nicer
type ConnectionMap ¶
type ConnectionMap[K comparable] map[K]map[K]int
func (ConnectionMap[K]) Betweeness ¶
func (cMap ConnectionMap[K]) Betweeness() map[K]float64
func (ConnectionMap[K]) Dijkstra ¶
func (cMap ConnectionMap[K]) Dijkstra(source K) (map[K]int, map[K]K)
func (ConnectionMap[K]) DijkstraWithDest ¶
func (cMap ConnectionMap[K]) DijkstraWithDest(source K, destination K) int
func (ConnectionMap[K]) EdgeBetweeness ¶
func (cMap ConnectionMap[K]) EdgeBetweeness() map[K]map[K]float64
func (ConnectionMap[K]) LongestDijkstraWithDest ¶
func (cMap ConnectionMap[K]) LongestDijkstraWithDest(source K, destination K) (int, []K)
type Coordinate ¶
func NewCoordinate ¶
func NewCoordinate(x int, y int) Coordinate
func (Coordinate) Add ¶
func (c Coordinate) Add(c2 Coordinate) Coordinate
func (Coordinate) MoveDir ¶
func (c Coordinate) MoveDir(dir Direction) Coordinate
func (Coordinate) StepsToCoordinate ¶
func (c Coordinate) StepsToCoordinate(c2 Coordinate) int
func (Coordinate) String ¶
func (c Coordinate) String() string
func (Coordinate) Sub ¶
func (c Coordinate) Sub(c2 Coordinate) Coordinate
type Coordinate3D ¶
type Coordinate3D[T Number] struct { X T Y T Z T }
func NewCoordinate3D ¶
func NewCoordinate3D[T Number](x, y, z T) Coordinate3D[T]
func (Coordinate3D[T]) String ¶
func (c Coordinate3D[T]) String() string
func (Coordinate3D[T]) Translate ¶
func (c Coordinate3D[T]) Translate(x, y, z T) Coordinate3D[T]
type Direction ¶
type Direction Coordinate
type PriorityQueue ¶
type PriorityQueue[K comparable, P cmp.Ordered] struct { // contains filtered or unexported fields }
func NewPriorityQueue ¶
func NewPriorityQueue[K comparable, P cmp.Ordered]() *PriorityQueue[K, P]
func (*PriorityQueue[K, P]) Init ¶
func (pq *PriorityQueue[K, P]) Init(vals map[K]P)
func (*PriorityQueue[_, _]) Len ¶
func (pq *PriorityQueue[_, _]) Len() int
func (*PriorityQueue[K, P]) Pop ¶
func (pq *PriorityQueue[K, P]) Pop() (K, P)
func (*PriorityQueue[K, P]) Push ¶
func (pq *PriorityQueue[K, P]) Push(v K, priority P)
func (*PriorityQueue[K, P]) SetPriorityOrder ¶
func (pq *PriorityQueue[K, P]) SetPriorityOrder(inverseOrder bool)
func (*PriorityQueue[K, P]) Update ¶
func (pq *PriorityQueue[K, P]) Update(v K, priority P)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.