stack

package
v1.2.56 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

stack is a stack(http://en.wikipedia.org/wiki/Stack_(abstract_data_type%29) is a last-in last-out data structure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

type Element list.Element

Element is an element of a linked list.

type Stack

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

take advantage of list

func New

func New() *Stack

Create a new stack

func (*Stack) Len

func (s *Stack) Len() int

Return the number of items in the stack

func (*Stack) Peek

func (s *Stack) Peek() *Element

View the top item on the stack

func (*Stack) Pop

func (s *Stack) Pop() *Element

Pop the top item of the stack and return it

func (*Stack) Push

func (s *Stack) Push(value interface{}) *Element

Push a value onto the top of the stack

Jump to

Keyboard shortcuts

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