namastey-circular-linked-list
Brief Description
namastey-circular-linked-list
is a JavaScript package that provides an implementation of the Circular Linked List data structure. It includes various methods for manipulating and interacting with the list.
Features
- append(value): Adds a new node with the specified value to the end of the list.
- insertAt(value, position): Inserts a new node with the specified value at the given position.
- remove(value): Removes the first node with the specified value from the list.
- find(value): Finds and returns the node with the specified value.
- printList(): Prints the entire list to the console.
- getSize(): Returns the number of nodes in the list.
Installation
To install the package globally, run:
npm install -g namastey-circular-linked-list
Examples
const CircularLinkedList = require('namastey-circular-linked-list');
const list = new CircularLinkedList();
list.append(10);
list.append(20);
list.append(30);
list.insertAt(15, 1);
list.printList();
console.log('Size of list:', list.getSize());
list.remove(20);
list.printList();