Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LinkedList

Examples

const { LinkedList } = require('dsajs');
// or  
// import { LinkedList } from 'dsajs';

let ds = new LinkedList();

Hierarchy

  • LinkedList

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • new LinkedList(head?: null | default): LinkedList

Properties

_head

_head: null | default

_last

_last: null | default

Accessors

head

  • get head(): null | default

last

  • get last(): undefined | default

size

  • get size(): number
  • Get the number of nodes

    Returns number

    the size of linked list (number of nodes)

Methods

append

  • append(data: any): void
  • Add data to the last of the list

    Parameters

    • data: any

      data to add to a list node

    Returns void

clear

  • clear(): void

delete

  • delete(compareFn: CompareFunction): void
  • Delete a node with respective to compare function

    Parameters

    • compareFn: CompareFunction

    Returns void

find

  • find(compareFn: CompareFunction): undefined | default
  • Find a node with respective to compare function

    Parameters

    • compareFn: CompareFunction

      (data) => boolean

    Returns undefined | default

    a list node if it is found or underfined

reverse

  • reverse(): void

toArray

  • toArray(): any[]
  • Convert linked list to array

    Returns any[]

    an array of all nodes data in each element

Generated using TypeDoc