You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

github.com/tadateruki/go-priority-queue

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/tadateruki/go-priority-queue

v0.0.0-20221014024551-28098c073e63
Source
Go
Version published
Created
Source

go-priority-queue

Simple implementation of Priority Queue in Golang.

Usage


package main

import (
	"fmt"

	priority_queue "github.com/TadaTeruki/go-priority-queue"
)

func main() {
	pq := new(priority_queue.PriorityQueue[string])

	pq.Push("a", 7.5)
	pq.Push("b", -2.1)
	pq.Push("c", 3.2)
	pq.Push("d", 0.0)

	item, priority, err := pq.Front()
	if err != nil {
		panic(err)
	}

	fmt.Println(item, priority)
}

Installation

 $ go get -u github.com/TadaTeruki/go-priority-queue

LICENSE

MIT License
Copyright (c) 2022 Teruki TADA

FAQs

Package last updated on 14 Oct 2022

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