Class Stack<T>

Stack data structure implemented with a linked list for efficient O(1) push and pop operations. Supports standard stack operations such as push, pop, and peek.

Type Parameters

  • T

    The type of elements held in the stack.

Constructors

Accessors

Methods

Constructors

Accessors

Methods

  • Returns the element at the top of the stack without removing it.

    Returns T

    The value at the top, or undefined if the stack is empty.

  • Removes and returns the element at the top of the stack.

    Returns T

    The value of the popped element, or undefined if the stack is empty.