stack

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2018 License: MIT Imports: 0 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

type Element struct {
	Value interface{}
	// contains filtered or unexported fields
}

Element is an element in a single linked list

func (*Element) Next

func (e *Element) Next() *Element

Next accesses the next element connected to this current node

type Stack

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

Stack represents a stack The zero value for Stack is an unintialized stack ought to initialize by invoking Init()

func New

func New() *Stack

New returns an initialized stack

func (*Stack) Empty

func (s *Stack) Empty() bool

Empty returns true if the stack is empty

func (*Stack) Len

func (s *Stack) Len() int

Len returns the size of the s

func (*Stack) Peek

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

Peek returns the element in the top of the s

func (*Stack) Peek2

func (s *Stack) Peek2() interface{}

Peek2 returns the element below the top of the stack

func (*Stack) Pop

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

Pop out the top element from the stack

func (*Stack) Push

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

Push adds an element to the stack

func (*Stack) ValueSlice

func (s *Stack) ValueSlice() []interface{}

ValueSlice returns all elements of stack in slice

Jump to

Keyboard shortcuts

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