@mquanit/ds-lib
is a TypeScript library that provides implementations of common data structures such as LinkedList and Queue.
You can install @mquanit/ds-lib
using npm, yarn and pnpm:
npm install @mquanit/ds-lib
yarn add @mquanit/ds-lib
The Queue class provides a basic implementation of a queue data structure.
import { Queue } from '@mquanit/ds-lib';
// Create a queue of strings
const myQueue = new Queue<string>();
myQueue.enqueue('apple');
myQueue.enqueue('banana');
myQueue.enqueue('orange');
// Perform operations on the queue
console.log('Front:', myQueue.front()); // Output: 'apple'
console.log('Size:', myQueue.size()); // Output: 3
myQueue.dequeue();
myQueue.printQueue(); // Output: ['banana', 'orange']
The LinkedList class allows you to create and manipulate a linked list.
import { LinkedList } from '@mquanit/ds-lib';
// Create a linked list of numbers
const myList = new LinkedList<number>();
myList.append(10);
myList.append(20);
myList.append(30);
// Display the linked list elements
myList.display();
Contributions are welcome! If you have any suggestions, bug reports, or enhancements, please open an issue or submit a pull request.
This project is licensed under the ISC License - see the LICENSE file for details.