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

@thi.ng/heaps

Package Overview
Dependencies
Maintainers
1
Versions
182
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/heaps

Generic binary heap & d-ary heap implementations with customizable ordering

  • 0.2.12
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
632
increased by31.94%
Maintainers
1
Weekly downloads
 
Created
Source

@thi.ng/heaps

npm (scoped)

This project is part of the @thi.ng/umbrella monorepo.

About

Type agnostic binary heap & d-ary heap implementations with customizable ordering and fanout / tree arity (in case of DHeap). Both Heap and DHeap have identical API.

Installation

yarn add @thi.ng/heaps

Dependencies

Usage examples

import { Heap, DHeap } from "@thi.ng/heaps";

// with initial values, custom comparator and heap arity
const h = new DHeap(
    [5, 2, 10, 15, 18, 23, 22, -1],
    {
        compare: (a,b) => b - a,
        d: 4
    }
);

h.pop();
// 23
h.pop();
// 22

// insert new value unless it's a new root
// else pop and return current root
h.pushPop(16)
// 18

h.push(24);

Authors

  • Karsten Schmidt

License

© 2017 - 2018 Karsten Schmidt // Apache Software License 2.0

Keywords

FAQs

Package last updated on 14 May 2018

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