Skip to content

Javascript implementation of a doubly linked list data structure.

License

Notifications You must be signed in to change notification settings

windfish-studio/doubly-linked-list

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Doubly Linked List

Description

This is a fork of Jason Jones' doubly-linked-list library, aimed to provide a doubly-linked-list data structure that also supports O(1) constant-time lookups of elements by ID.

This is accomplished by:

  • Quickly generating a unique ID for each element inserted into the doubly-linked list.
  • Index all entries in the list by their ID, in a hashtable which is maintained internally by the library. Depending on the javascript implementation, this implies storage (memory) requirements of O(n^2).

Usage

list = new LinkedList();
list.insert("a");
// => true
const node = list.getHeadNode();
node.id;
// => "c12Bzz81"
list.findById("c12Bzz81") == node;
// => true

API

The original doubly-linked-list documentation can be found on Jason Jones github page for the original library. On this page I'll only provide the documentation for features added in this fork.

.findByID(id: string)

This will return the node in the list which corresponds with the passed ID string.

About

Javascript implementation of a doubly linked list data structure.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%