Stack

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// linked_stack with no maximum size Implementation
	LINKED int = iota

	// ArrayStack with no maximum size Implementation
	ARRAY
)

Variables

View Source
var (
	StackHead string = " | →"
	StackSep  string = " | "
)

Functions

This section is empty.

Types

type ErrEmptyStack

type ErrEmptyStack struct{}

func (ErrEmptyStack) Error

func (e ErrEmptyStack) Error() string

type ErrFullStack

type ErrFullStack struct{}

func (ErrFullStack) Error

func (e ErrFullStack) Error() string

type Stack

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

func NewLimitedStack

func NewLimitedStack[T any](implementation, capacity int, values ...T) Stack[T]

func NewStack

func NewStack[T any](implementation int, values ...T) Stack[T]

func (*Stack[T]) Clear

func (stack *Stack[T]) Clear()

func (Stack[T]) IsEmpty

func (stack Stack[T]) IsEmpty() bool

func (Stack[T]) IsFull

func (stack Stack[T]) IsFull() bool

func (Stack[T]) Peek

func (stack Stack[T]) Peek() T

func (*Stack[T]) Pop

func (stack *Stack[T]) Pop() T

func (*Stack[T]) Push

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

func (Stack[T]) Size

func (stack Stack[T]) Size() int

func (*Stack[T]) String

func (stack *Stack[T]) String() string

func (*Stack[T]) ToSlice

func (stack *Stack[T]) ToSlice() []T

Jump to

Keyboard shortcuts

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