A LinkedList is a linear data structure where each element (node) contains a reference (link) to the next node in the sequence. This allows for efficient insertion and deletion of elements, as nodes can be added or removed without shifting other elements.
import { LinkedList } from "collection-kit";
import { LinkedList } from "collection-kit";
const list = new LinkedList();
list.add(10);
list.add(20);
list.add(30);
console.log("Size:", list.size()); // 3
console.log("First element:", list.get(0)); // 10
console.log("All elements:");
for (let i = 0; i < list.size(); i++) {
console.log(`Element ${i}:`, list.get(i));
}