0.3.0 • Published 5 years ago

@jsdsl/doubly-linked-list v0.3.0

Weekly downloads
-
License
GPL-3.0-or-later
Repository
github
Last release
5 years ago

JSDSL - Doubly Linked List

A full-featured doubly-linked list implementation.

Find @jsdsl/doubly-linked-list on NPM.

Table of Contents

Installation

Install from NPM with

$ npm install --save @jsdsl/doubly-linked-list

Basic Usage

A basic use case would be as follows:

import { DoublyLinkedList, DoublyLinkedListNode } from "@jsdsl/doubly-linked-list";

// Initialize the doubly-linked list.
let dll: DoublyLinkedList<string> = new DoublyLinkedList<string>();

// Add an element: 'turtle'
dll.add("turtle");

// Add at element at the beginning of the list.
let catNode: DoublyLinkedListNode<E> = dll.insertFirst("cat");

// Insert an element, 'dog', after the 'cat' element.
dll.insertAfter("dog", catNode);

// The list's current state:
// 'cat' <--> 'dog' <--> 'turtle'

Documentation

See the wiki for full documentation.

License

@jsdsl/doubly-linked-list is made available under the GNU General Public License v3.

Copyright (C) 2019 Trevor Sears