Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LinkedListStack ¶
type LinkedListStack[T any] struct { // contains filtered or unexported fields }
LinkedListStack represents a LIFO (last-in, first-out) stack implemented using a linked list.
func New ¶
func New[T any]() *LinkedListStack[T]
New creates and returns a new, empty linked list stack.
func (*LinkedListStack[T]) Clear ¶
func (s *LinkedListStack[T]) Clear()
Clear removes all items from the stack, leaving it empty.
func (*LinkedListStack[T]) IsEmpty ¶
func (s *LinkedListStack[T]) IsEmpty() bool
IsEmpty checks if the stack is empty.
func (*LinkedListStack[T]) Len ¶
func (s *LinkedListStack[T]) Len() int
Len returns the number of items currently in the stack.
func (*LinkedListStack[T]) Peek ¶
func (s *LinkedListStack[T]) Peek() (T, bool)
Peek returns the item at the top of the stack without removing it. Returns false if the stack is empty.
func (*LinkedListStack[T]) Pop ¶
func (s *LinkedListStack[T]) Pop() (T, bool)
Pop removes and returns the item from the top of the stack. Returns false if the stack is empty.
func (*LinkedListStack[T]) Push ¶
func (s *LinkedListStack[T]) Push(item T)
Push adds an item to the top of the stack.
Click to show internal directories.
Click to hide internal directories.