Skip to content

Latest commit

 

History

History
72 lines (47 loc) · 1.27 KB

linkedList.md

File metadata and controls

72 lines (47 loc) · 1.27 KB

LinkedList Documentation

A LinkedList is a data structure consisting of a group of nodes which together represent a sequence. Each node is composed of data and a reference (in other words, a link) to the next node in the sequence.

Table of Contents

Initialization

To initialize a new linked list, instantiate the LinkedList class:

const list = new LinkedList<number>();

Methods

append

Adds an element to the end of the linked list.

list.append(value: T): void;

prepend

Adds an element to the beginning of the linked list.

list.prepend(value: T): void;

find

Searches for an element with the given value in the linked list.

list.find(value: T): Node<T> | null;

delete

Removes an element with the given value from the linked list.

list.delete(value: T): void;

isEmpty

Checks if the linked list is empty.

list.isEmpty(): boolean;

print

Returns a string representation of the linked list.

list.print(): string;