🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

@windfish-studio/dbly-linked-hashtable-list

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@windfish-studio/dbly-linked-hashtable-list

Javascript implementation of a doubly linked-list data structure, with built-in hashtable for O(1) lookups and removals

0.3.4
latest
Version published
Maintainers
1
Created

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.

FAQs

Package last updated on 10 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts