Skip to content

meshuggahbobo/linked-lists

Repository files navigation

Logo

linked-lists

Singly & Doubly Linked Lists in Javascript


Maintained

-----------------------------------------------------

➤ License

Licensed under MIT.

-----------------------------------------------------

➤ Classes

SinglyLinkedList

Singly Linked List Class

SinglyLinkedListNode

Singly Linked List Node Class

-----------------------------------------------------

➤ SinglyLinkedList

Singly Linked List Class

Kind: global class

singlyLinkedList.insertAtHead(data)

Insert a new node in the Singly Linked List

Kind: instance method of SinglyLinkedList

Param Type Description
data * to be stored in the node

singlyLinkedList.getByIndex(index) ⇒

Get the node at passed index

Kind: instance method of SinglyLinkedList
Returns: the node at index position

Param Type Description
index Number of the node to be retrived

singlyLinkedList.getMiddleNode() ⇒

Return the middle node of the list

Kind: instance method of SinglyLinkedList
Returns: Return the middle node of the list

singlyLinkedList.print()

Print the Singly Linked List in human readble mode

Kind: instance method of SinglyLinkedList

singlyLinkedList.insertAtIndex(index, value)

Insert new node in the passed index of the Singly Linked List

Kind: instance method of SinglyLinkedList

Param Type Description
index Number of the List
value * to be stored in the node

singlyLinkedList.removeHead()

Removed the current head of the Singly Linked List

Kind: instance method of SinglyLinkedList

singlyLinkedList.removeAtIndex(index)

Remove node at passed index

Kind: instance method of SinglyLinkedList

Param Type Description
index Number of the node to be removed

SinglyLinkedList.fromValues(...values) ⇒ SinglyLinkedList

Helper function to create a SinglyLinkedList from an array of values

Kind: static method of SinglyLinkedList
Returns: SinglyLinkedList - Singly Linked List created

Param Type Description
...values any data values of each node

-----------------------------------------------------

➤ SinglyLinkedListNode

Singly Linked List Node Class

Kind: global class

new SinglyLinkedListNode(value, next)

Param Type Description
value * of the node to be stored
next SinglyLinkedListNode node to be pointed

-----------------------------------------------------

➤ Classes

DoublyLinkedList

Doubly Linked List Class

DoublyLinkedListNode

Doubly Linked List Node Class

-----------------------------------------------------

➤ DoublyLinkedList

Doubly Linked List Class

Kind: global class

doublyLinkedList.getByIndex(index) ⇒

Get the node at passed index

Kind: instance method of DoublyLinkedList
Returns: the node at index position

Param Type Description
index Number of the node to be retrived

doublyLinkedList.push(value) ⇒

The push() mehod add new node to the end of the Doubly Linked List

Kind: instance method of DoublyLinkedList
Returns: the new Doubly Linked List with the new last node

Param Type Description
value * of the new node

doublyLinkedList.pop() ⇒

The pop() method removes the last element from the Doubly Linked List

Kind: instance method of DoublyLinkedList
Returns: the new Doubly Linked List without the last node

doublyLinkedList.shift() ⇒

The shift() method removes the first element from the Doubly Linked List

Kind: instance method of DoublyLinkedList
Returns: the new Doubly Linked List without the first node

doublyLinkedList.unshift(val) ⇒

The unshift() method adds the new node to the head of the current Doubly Linked List

Kind: instance method of DoublyLinkedList
Returns: the new Doubly Linked List with the new head node

Param Type Description
val * Value of the new node

doublyLinkedList.print()

Print the Doubly Linked List in human readble mode

Kind: instance method of DoublyLinkedList

DoublyLinkedList.fromValues(...values) ⇒ DoublyLinkedList

Helper function to create a DoublyLinkedList from an array of values

Kind: static method of DoublyLinkedList
Returns: DoublyLinkedList - Doubly Linked List created

Param Type Description
...values any data values of each node

-----------------------------------------------------

➤ DoublyLinkedListNode

Doubly Linked List Node Class

Kind: global class

new DoublyLinkedListNode(value)

Param Type Description
value * of the node to be stored

-----------------------------------------------------

➤ Contributors

Andrea Oboe
Andrea Oboe
info@andreaoboe.com
🔥

-----------------------------------------------------

➤ License

Licensed under MIT.

About

Linked Lists in Javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published