stack

package
Version: v0.0.0-...-433e763 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2016 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL