Documentation ¶
Overview ¶
Package stack is a simple implementation of the stack data structure.
Example (BasicUsage) ¶
package main import ( "fmt" "github.com/eng618/go-eng/ds/stack" ) func main() { s := stack.New() s.Push(25) s.Push(1) s.Push(2) if v, err := s.Pop(); err == nil { fmt.Println("Pop returned", v) } }
Output: Pop returned 2
Example (SeededList) ¶
package main import ( "fmt" "github.com/eng618/go-eng/ds/stack" ) func main() { s := stack.NewSeeded([]stack.Item{1, 2, 3, 4, 5}) if v, err := s.Pop(); err == nil { fmt.Println("Pop returned", v) } }
Output: Pop returned 5
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Stack ¶ added in v0.5.0
type Stack struct { Items []Item // contains filtered or unexported fields }
Stack is the structure to interact with the stack package.
Click to show internal directories.
Click to hide internal directories.