stack

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package stack provides an implementation of the stack data structure in Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

type Stack[T any] struct {
	// contains filtered or unexported fields
}

Stack is an implementation of stack.

func New

func New[T any]() *Stack[T]

New creates a new stack.

func (*Stack[T]) Empty

func (s *Stack[T]) Empty() bool

Empty returns whether the stack is empty or not.

func (Stack[T]) Len

func (s Stack[T]) Len() int

Size returns the size of the stack.

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() T

Pop pops a value from the queue.

func (*Stack[T]) Push

func (s *Stack[T]) Push(value T)

Push pushes a value into the stack.

func (*Stack[T]) Top

func (s *Stack[T]) Top() T

Top returns the value at the top of the queue.

Jump to

Keyboard shortcuts

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