stack

package module
v0.0.0-...-8674f52 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2016 License: MIT Imports: 2 Imported by: 0

README

MIT Licence GoDoc Build Status

Stack

LIFO data structure

Index

###New

###Empty

###Pop

###Push

###Reverse

###Size

###Swap

###Top

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

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

Stack represents the LIFO data structure.

func New

func New(params ...*list.List) (*Stack, error)

Constructor for Stack. If params is empty, it will new a empty Stack. Or you can pass a List to initialize the Stack.

func (*Stack) Empty

func (sta *Stack) Empty() bool

Check whether the Stack is empty or not.

func (*Stack) Pop

func (sta *Stack) Pop()

Delete the top value in Stack. If the Stack is empty, it will do nothing.

func (*Stack) Push

func (sta *Stack) Push(val interface{})

Insert the value above the top.

func (*Stack) Reverse

func (sta *Stack) Reverse()

Reverse the contents in the Stack.

func (*Stack) Size

func (sta *Stack) Size() int

Get the Stack size.

func (*Stack) Swap

func (sta1 *Stack) Swap(sta2 *Stack)

Swap the contents of two Stacks.

func (*Stack) Top

func (sta *Stack) Top() interface{}

Get the top value in Stack. If the Stack is empty, you will get nil.

Jump to

Keyboard shortcuts

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