Giter VIP home page Giter VIP logo

priority-queue-nodejs's Introduction

Priority Queue (NodeJS)

It’s a simple implementation of a PriorityQueue for NodeJS. As the code is JavaScript it could be used on the browser without any trouble.

The basic usage is to push() elements and give them a priority to be used into the queue. You can also set a custom compare() function and a limit of elements to be held into the queue. Any elements at the same priority will be first in, first out.

More examples can be found into the tests folder.


queue = new PriorityQueue();
queue.push(“Most important note”, 99);
queue.push(“Important note”, 50);
queue.push(“Silly notice”, 1);

x = queue.top(); // Most important note
x = queue.top(); // Important note
x = queue.top(); // Silly notice
x = queue.top(); // undefined

priority-queue-nodejs's People

Contributors

josephg avatar munro avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.