chapter3

package
v0.0.0-...-45e99ae Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const TypeCat = "CAT"
View Source
const TypeDog = "DOG"

Variables

This section is empty.

Functions

This section is empty.

Types

type AnimalNode

type AnimalNode struct {
	Type  string
	Value int
}

type LengthAwareStack

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

type MinAwareStack

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

func (*MinAwareStack) IsEmpty

func (stack *MinAwareStack) IsEmpty() bool

func (*MinAwareStack) Min

func (stack *MinAwareStack) Min() (int, error)

func (*MinAwareStack) Peek

func (stack *MinAwareStack) Peek() (int, error)

func (*MinAwareStack) Pop

func (stack *MinAwareStack) Pop() (int, error)

func (*MinAwareStack) Push

func (stack *MinAwareStack) Push(data int)

type MultiArrayStack

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

We assume the 3 stacks of length = 4 each

func NewMultiArrayStack

func NewMultiArrayStack() *MultiArrayStack

func (*MultiArrayStack) AssertStackIndexIsWithinRange

func (stack *MultiArrayStack) AssertStackIndexIsWithinRange(stackIndex int)

func (*MultiArrayStack) IsEmpty

func (stack *MultiArrayStack) IsEmpty(stackIndex int) bool

func (*MultiArrayStack) Peek

func (stack *MultiArrayStack) Peek(stackIndex int, data int) (int, error)

func (*MultiArrayStack) Pop

func (stack *MultiArrayStack) Pop(stackIndex int) (int, error)

func (*MultiArrayStack) Push

func (stack *MultiArrayStack) Push(stackIndex int, data int) error

type MultiDimensionalStack

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

func (*MultiDimensionalStack) IsEmpty

func (stack *MultiDimensionalStack) IsEmpty() bool

func (*MultiDimensionalStack) Peek

func (stack *MultiDimensionalStack) Peek() (int, error)

func (*MultiDimensionalStack) Pop

func (stack *MultiDimensionalStack) Pop() (int, error)

func (*MultiDimensionalStack) PopAt

func (stack *MultiDimensionalStack) PopAt(index int) (int, error)

func (*MultiDimensionalStack) Print

func (stack *MultiDimensionalStack) Print() string

func (*MultiDimensionalStack) Push

func (stack *MultiDimensionalStack) Push(data int)

type NodeStack

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

type Queue

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

func (*Queue) Add

func (queue *Queue) Add(data int)

func (*Queue) IsEmpty

func (queue *Queue) IsEmpty() bool

func (*Queue) Remove

func (queue *Queue) Remove() (int, error)

type QueueNode

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

type QueueUsingStacks

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

func (*QueueUsingStacks) Add

func (queue *QueueUsingStacks) Add(data int)

func (*QueueUsingStacks) IsEmpty

func (queue *QueueUsingStacks) IsEmpty() bool

func (*QueueUsingStacks) Peek

func (queue *QueueUsingStacks) Peek() (int, error)

func (*QueueUsingStacks) Remove

func (queue *QueueUsingStacks) Remove() (int, error)

type Shelter

type Shelter struct {
	Inventory *list.List
}

func GetNewShelter

func GetNewShelter() *Shelter

func (*Shelter) DequeueAny

func (shelter *Shelter) DequeueAny() (AnimalNode, error)

func (*Shelter) DequeueCat

func (shelter *Shelter) DequeueCat() (AnimalNode, error)

func (*Shelter) DequeueDog

func (shelter *Shelter) DequeueDog() (AnimalNode, error)

func (*Shelter) Enqueue

func (shelter *Shelter) Enqueue(node AnimalNode)

func (*Shelter) IsEmpty

func (shelter *Shelter) IsEmpty() bool

type Stack

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

func (*Stack) Empty

func (stack *Stack) Empty()

func (*Stack) IsEmpty

func (stack *Stack) IsEmpty() bool

func (*Stack) Peek

func (stack *Stack) Peek() (int, error)

func (*Stack) Pop

func (stack *Stack) Pop() (int, error)

func (*Stack) Push

func (stack *Stack) Push(data int)

func (*Stack) Sort

func (stack *Stack) Sort()

func (*Stack) ToArray

func (stack *Stack) ToArray() []int

type StackNode

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

Jump to

Keyboard shortcuts

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