Skip to content

node package for top and bottom plus lifo/ fifo queues, stack, priority queues, double ended queues, circular queues, wait queues, and semaphore queues implementation

License

Notifications You must be signed in to change notification settings

ganeshkbhat/queues.js

Repository files navigation

queues.js

npm module for start ended lifo/ fifo, normal js ended lifo/ fifo, double ended queue and semaphore queue implementation

Find the demos in the demos folder

APIs queues.js

Commonjs Code


var queues = require("queues.js");
var QueueFifo = require("queues.js").QueueLifo;
var QueueLifo = require("queues.js").QueueFifo;


// FIFO BOTTOM QUEUE IMPLEMENTATION
//   <==   [1,2,3,4]  <==
var fifo = new QueueFifo();
fifo.enqueue(item);
fifo.add(item);
fifo.insert(item);
fifo.push(item);

fifo.dequeue();
fifo.shift();
fifo.remove();


// LIFO BOTTOM QUEUE IMPLEMENTATION
//   [1,2,3,4]  <==
//              ==>
var lifo = new QueueLifo();
lifo.enqueue(item);
lifo.add(item);
lifo.push(item);
lifo.insert(item);

lifo.dequeue();
lifo.pop();
lifo.remove();


ESM Code


import { default as queues, QueueLifo, QueueFifo } as "queues.js";
var fifo = new QueueFifo();
var lifo = new QueueLifo();


ESM or Commonjs Code


var queues = import("queues.js");
var QueueFifo = import("queues.js").QueueLifo;
var QueueLifo = import("queues.js").QueueFifo;
var fifo = new QueueFifo();
var lifo = new QueueLifo();

Base


const { Base, BaseLowFootprint, AsyncBase, AsyncBaseLowFootPrint } = require("queues.js");

// Base - Persistent Queue
// BaseLowFootprint - Non-Persistent Queue
// Queue - Persistent Queue
// QueueLowFootprint - Non-Persistent Queue
// All LowFootprint names classes / functions are non-persistent queues

Queue Types

Queue (includes all Base methods)


const { Queue, QueueLowFootprint, QueueLifo, QueueFifo, QueueLowFootprintLifo, QueueLowFootprintFifo, AsyncQueue, AsyncQueueLowFootprint } = require("queues.js");


Queue Bottom Fifo

Queue Bottom Lifo

QueueTop (includes all Base methods)


const { QueueTop, QueueTopLowFootprint, QueueTopLifo, QueueTopFifo, QueueTopLowFootprintLifo, QueueTopLowFootprintFifo, AsyncQueueTop, AsyncQueueTopLowFootprint } = require("queues.js");


Queue Top Fifo

Queue Top Lifo

Stack (includes all Base methods)


const { Stack, StackLowFootprint, AsyncStack, AsyncStackLowFootprint } = require("queues.js");


Stack

Double - Denqueue (includes all Base methods)


const { DoubleEnded, DoubleEndedLowFootprint, AsyncDoubleEnded, AsyncDoubleEndedLowFootprint } = require("queues.js");


Double Ended Queue

Semaphore (includes all Base methods)


const { Semaphore } = require("queues.js");


WaitQueue (includes all Base methods)


const { WaitQueue } = require("queues.js");


Priority Queue (includes all Base methods)


const { Priority, PriorityLowFootprint, AsyncPriority, AsyncPriorityLowFootprint } = require("queues.js");


Priority Queue

Circular Queue (includes all Base methods)


const { Circular, AsyncCircular } = require("queues.js");


Circular Queue

Contributions

Contributions, Feature Improvements, Bugs, and Issues are invited. raising an issue

License

MIT License

About

node package for top and bottom plus lifo/ fifo queues, stack, priority queues, double ended queues, circular queues, wait queues, and semaphore queues implementation

Resources

License

Stars

Watchers

Forks

Packages

No packages published