yasll
v1.0.5
Published
Yet another linked list
Downloads
4
Maintainers
Readme
Linked List
A singly linked list which handles all the complexities of node creation and deletion. You don't need to manually create nodes; instead, you can utilize the linked list data structure as a whole and perform various standard operations
Installation
npm install yasll
Usage
import { LinkedList } from 'yasll'
const ll = new LinkedList()
ll.append("First")
ll.shift()
ll.prepend("Second")
ll.pop()
ll.append("Third")
ll.insertAt(0, "Fourth")
console.log(ll.size)
For a global linked list instance, you can use singletonLL
import { singletonLL } from 'yasll'
singletonLL.append(1)
Documentation
Methods
- append: Add an element to the end of the list.
- preprend: Add an element to the beginning of the list.
- find: Find an element in the list.
- pop: Remove the last element from the list.
- shift: Remove the first element from the list.
- insertAt: Insert an element at a specific index in the list.
- deleteAt: Delete an element at a specific index in the list.
Properties
- size: Number of elements in the list.
- head: First element of the list.
- tail: Last element of the list.
This library simplifies the management of linked lists, making it easier to handle various operations seamlessly.