efficient-queue
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

Queue Implementation

A simple and efficient implementation of a queue data structure in TypeScript. This package provides a generic Queue class which can be used in various JavaScript and TypeScript applications where queue functionality is needed.

Features

  • Simple and intuitive API
  • Generic implementation supporting different data types
  • Methods for enqueueing, dequeueing, peeking, checking length, and verifying if the queue is empty

Installation

To install the package, run the following command in your project directory:

npm install efficient-queue

Usage Examples

import { Queue } from 'queue';

// Creating a new queue
const queue = new Queue<number>();

// Enqueueing elements
queue.enqueue(1);
queue.enqueue(2);
queue.enqueue(3);

// Dequeueing elements
console.log(queue.dequeue()); // 1
console.log(queue.dequeue()); // 2

// Peeking at the front element
console.log(queue.peek()); // 3

// Checking if the queue is empty
console.log(queue.isEmpty()); // false

// Checking the length of the queue
console.log(queue.length()); // 1

Keywords

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.4
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.4
    0
  • 0.0.3
    0
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i efficient-queue

Weekly Downloads

0

Version

0.0.4

License

ISC

Unpacked Size

16.5 kB

Total Files

9

Last publish

Collaborators

  • rahuja445