stack

package
v0.0.0-...-c4df37a Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2021 License: MIT Imports: 2 Imported by: 0

README

Stack

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorExceededCapacity = errors.New("capacity is exceeded")
	ErrorEmptyStack       = errors.New("can't perform pop, peek on empty stack")
)

Functions

This section is empty.

Types

type ArrayStack

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

func NewArrayStack

func NewArrayStack(capacity int) *ArrayStack

func (*ArrayStack) IsEmpty

func (s *ArrayStack) IsEmpty() bool

func (*ArrayStack) IsFull

func (s *ArrayStack) IsFull() bool

func (*ArrayStack) Peek

func (s *ArrayStack) Peek() (interface{}, error)

func (*ArrayStack) Pop

func (s *ArrayStack) Pop() (interface{}, error)

func (*ArrayStack) Push

func (s *ArrayStack) Push(element interface{}) error

func (*ArrayStack) Size

func (s *ArrayStack) Size() int

type LinkedListStack

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

func NewLinkedListStack

func NewLinkedListStack(capacity int) *LinkedListStack

func (*LinkedListStack) IsEmpty

func (s *LinkedListStack) IsEmpty() bool

func (*LinkedListStack) IsFull

func (s *LinkedListStack) IsFull() bool

func (*LinkedListStack) Peek

func (s *LinkedListStack) Peek() (interface{}, error)

func (*LinkedListStack) Pop

func (s *LinkedListStack) Pop() (interface{}, error)

func (*LinkedListStack) Push

func (s *LinkedListStack) Push(element interface{}) error

func (*LinkedListStack) Size

func (s *LinkedListStack) Size() int

type Stack

type Stack interface {
	Push(element interface{}) error
	Peek() (interface{}, error)
	Pop() (interface{}, error)
	IsFull() bool
	IsEmpty() bool
	Size() int
}

Stack is an ADT.

Jump to

Keyboard shortcuts

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