Documentation
¶
Overview ¶
Package stack provides implementation for Stack data structure https://simple.wikipedia.org/wiki/Stack_(data_structure)
Interface methods Push,Pop, Peek,IsEmpty,Size are the ways to interact with stack data structure. The test file stack_test.go illustrates usage of these methods
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Stack ¶
type Stack[T any] interface { // Push element to the stack Push(T) // Pop element from the top of the stack // If stack is empty, panics Pop() T // Peek check the value of top element // If stack is empty, panics Peek() T // IsEmpty returns true if stack is empty, call before Pop and Peek IsEmpty() bool // Size returns number of elements in the stack Size() int }
Interface implemented by stack, LIFO
Click to show internal directories.
Click to hide internal directories.