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

functional-red-black-tree

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
f

functional-red-black-tree

A fully persistent balanced binary search tree

1.0.1
latest
100

Supply Chain Security

100

Vulnerability

100

Quality

76

Maintenance

100

License

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Issues
13

What is functional-red-black-tree?

The functional-red-black-tree npm package provides an implementation of a functional (immutable) red-black tree, a type of self-balancing binary search tree. It allows for efficient insertion, deletion, and lookup of elements while maintaining a balanced tree structure. The functional aspect means that instead of modifying the tree in place, operations return a new tree, preserving the original structure.

What are functional-red-black-tree's main functionalities?

Insertion

This feature allows for the insertion of a key-value pair into the tree. The operation returns a new tree with the element added, maintaining the original tree unchanged.

const RBT = require('functional-red-black-tree');
let tree = RBT();
tree = tree.insert(1, 'value');

Deletion

This feature enables the removal of an element by its key from the tree. Similar to insertion, it returns a new tree with the specified element removed, leaving the original tree intact.

tree = tree.remove(1);

Lookup

This feature allows for the retrieval of a value by its key from the tree. It returns the value associated with the key if it exists, or undefined if the key is not found in the tree.

const value = tree.get(1);

Other packages similar to functional-red-black-tree

FAQs

Package last updated on 29 Sep 2014

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