Back to godoc.org

Package stack

v0.0.0-...-433e763
Latest Go to latest

The highest tagged major version is .

Published: Aug 23, 2016 | License: BSD-3-Clause | Module: github.com/chrisbbe/GoAnalysis

Overview

Package graph.stack provides an implementation of the Stack abstract-datastructure, basically providing the standard graph.stack operating primitives.

Author: Mark Summerfield, found in the book: "Programming in Go, Creating Applications for the 21st Century"

Author: Christian Bergum Bergersen, added comments to satisfy Golang code convention.

Index

type Stack

type Stack []interface{}

Stack is an array data-structure with the properties of a LIFO queue.

func (Stack) Cap

func (stack Stack) Cap() int

Cap returns the capacity of the graph.stack.

func (Stack) IsEmpty

func (stack Stack) IsEmpty() bool

IsEmpty returns true if graph.stack is empty, false otherwise.

func (Stack) Len

func (stack Stack) Len() int

Len returns the size(length) of the graph.stack.

func (*Stack) Pop

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

Pop removes and returns the first(top) element of the graph.stack, or returns an error message if the graph.stack is empty.

func (*Stack) Push

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

Push puts x on the top of the graph.stack.

func (Stack) Top

func (stack Stack) Top() (interface{}, error)

Top returns the first first(top) element in the graph.stack, or error message if the graph.stack is empty.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier