Show / Hide Table of Contents

    Class Stack<T>

    A stack implementation.

    Inheritance
    Object
    Stack<T>
    Namespace: Advanced.Algorithms.DataStructures.Foundation
    Assembly: Advanced.Algorithms.dll
    Syntax
    public class Stack<T> : IEnumerable<T>
    Type Parameters
    Name Description
    T

    Constructors

    Stack(StackType)

    Declaration
    public Stack(StackType type = default(StackType))
    Parameters
    Type Name Description
    StackType type

    The stack type to use.

    Properties

    Count

    The total number of items in this stack.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    Int32

    Methods

    GetEnumerator()

    Declaration
    public IEnumerator<T> GetEnumerator()
    Returns
    Type Description
    IEnumerator<T>

    Peek()

    Peek from stack. Time complexity:O(1).

    Declaration
    public T Peek()
    Returns
    Type Description
    T

    The item peeked.

    Pop()

    Time complexity:O(1).

    Declaration
    public T Pop()
    Returns
    Type Description
    T

    The item popped.

    Push(T)

    Time complexity:O(1).

    Declaration
    public void Push(T item)
    Parameters
    Type Name Description
    T item

    The item to push.

    Back to top Generated by DocFX