stack

package module
v0.0.0-...-c969036 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: GPL-3.0 Imports: 0 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

type Stack[T any] []T

func New

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

func (*Stack[T]) Pop

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

Pop an element from the stack in O(1) time.

func (*Stack[T]) PopN

func (s *Stack[T]) PopN(n int)

Pop multiple elements from the stack in O(1) time.

func (*Stack[T]) Push

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

Push an element onto the stack in O(1) time.

func (*Stack[T]) Top

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

Peek at the top element of the stack in O(1) time.

Jump to

Keyboard shortcuts

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