datastructures

package
v0.0.0-...-afe6d48 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintEgDirectedGraph

func PrintEgDirectedGraph()

Types

type Graph

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

Graph structure

func (*Graph) AddEdge

func (g *Graph) AddEdge(to, from int) error

AddEdge will add ad endge from a vertex to a vertex

func (*Graph) AddVertex

func (g *Graph) AddVertex(vertex int) error

AddVertext will add a vertex to a graph

func (*Graph) Print

func (g *Graph) Print()

type Stack

type Stack[T any] struct {
	// contains filtered or unexported fields
}

Stack represents a stack of elements.

func NewStack

func NewStack[T any](initialCapacity ...int) Stack[T]

NewStack returns a new stack.

func (*Stack[T]) IsEmpty

func (s *Stack[T]) IsEmpty() bool

IsEmpty returns true if the stack is empty.

func (*Stack[T]) Len

func (s *Stack[T]) Len() int

Len returns the number of elements in the stack.

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() (zero T, err error)

Pop removes and returns the top element of the stack.

func (*Stack[T]) Push

func (s *Stack[T]) Push(value T)

Push pushes the element onto the stack.

type Vertex

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

Adjacent Vertex

Jump to

Keyboard shortcuts

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