Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

functional-red-black-tree

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

functional-red-black-tree

A fully persistent balanced binary search tree

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11M
decreased by-20.73%
Maintainers
1
Weekly downloads
 
Created

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

Keywords

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc