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

github.com/jhm/go-binaryheap/v2

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/jhm/go-binaryheap/v2

  • v2.0.0
  • Source
  • Go
  • Socket score

Version published
Created
Source

go-binaryheap

A slice backed binary heap where the order can be customized by a comparison function. The main branch now requires go 1.18 because the heap makes use of generic type parameters. For a version that works on Go 1.17 and below see the v1.0.0 tag.

Usage

// Construct a new max heap containing ints.
h := binaryheap.New(func(a, b int) bool { return a > b })

// Add an int to the heap.
h.Push(1)

// Add multiple ints to the heap.
h.PushAll(2, 3)

// Retrieve the top item.
a, found := h.Peek()

// Retrieve the top item and remove it from the heap.
b, found := h.Pop()

Future Changes

The tests will most likely be updated to use the new fuzzing API released in Go 1.18.

FAQs

Package last updated on 15 Dec 2021

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