Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

  • T

Hierarchy

  • SinglyLinkedList

Index

Constructors

Properties

head: null | SinglyLinkedNode<T>
size: number
tail: null | SinglyLinkedNode<T>

Methods

  • [iterator](): Generator<T, void, unknown>
  • get(index: number): null | T
  • Retrieves the element at given index

    Time complexity: O(n) Space complexity: O(1)

    Parameters

    • index: number

    Returns null | T

  • insert(value: T, index: number): boolean
  • Inserts a new node on a specified position

    Time complexity: O(n) Space complexity: O(1)

    Parameters

    • value: T
    • index: number

    Returns boolean

  • pop(): null | T
  • push(value: T): number
  • Adds a node to the end of the list

    Time complexity: O(1) Space complexity: O(1)

    Parameters

    • value: T

    Returns number

    the size of the list

  • remove(index: number): null | T
  • Removes a node at specified position

    Time complexity: O(n) Space complexity: O(1)

    Parameters

    • index: number

    Returns null | T

  • set(value: T, index: number): boolean
  • Updates the value of a node on a provided position

    Time complexity: O(n) Space complexity: O(1)

    Parameters

    • value: T
    • index: number

    Returns boolean

  • shift(): null | T
  • toString(): string
  • unshift(value: T): number
  • Adds a new node to the beginning of the list

    Time complexity: O(1) Space complexity: O(1)

    Parameters

    • value: T

    Returns number

    the size of the list

Generated using TypeDoc