@ds-javascript/singly-linked-list

1.0.1 • Public • Published

@ds-javascript/singly-linked-list

Usage

const SinglyLinkedList = require('@ds-javascript/singly-linked-list');
const list = new SinglyLinkedList();

API

.push(value) adds a node of the given value at the end of the list.

list.push('node value');

.pop() removes node from end of the list.

list.pop();

.shift() removes a node from beginning of the list.

list.shift();

.unshift(value) adds a node of the given value at the beginning of the list.

list.unshift('node value');

.get(index) get node at the provided index of the list.

list.get(1);

.set(value,index) set value of node at the provided index of the list.

list.set('node value,'1);

.insert(value,index) insert node at the provided index of the list.

list.insert('node value,'1);

.remove(index) delete node from provided index of the list.

list.remove(1);

.getList() get entire list

list.getList();

/@ds-javascript/singly-linked-list/

    Package Sidebar

    Install

    npm i @ds-javascript/singly-linked-list

    Weekly Downloads

    1

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    4.07 kB

    Total Files

    3

    Last publish

    Collaborators

    • opensourcedj