llstack

package
v0.0.0-...-81e6950 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

type Stack struct {
	Head *node
	// contains filtered or unexported fields
}

Stack represents the linked list implementation of the stack.

func InitStack

func InitStack() *Stack

InitStack initializes and returns a reference to a new stack instance.

func (*Stack) IsEmpty

func (s *Stack) IsEmpty() bool

IsEmpty checks if the stack is empty.

func (*Stack) Peek

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

Peek returns the top most element of the stack or an error if the stack is empty.

func (*Stack) Pop

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

Pop deletes the top most element of the stack and returns it or returns an error if the stack is empty.

func (*Stack) Push

func (s *Stack) Push(data interface{})

Push adds a new element at the top of the stack.

func (*Stack) Size

func (s *Stack) Size() int

Size returns the size of the stack.

Jump to

Keyboard shortcuts

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