Class: LinkedList

data-structures/linked-list. LinkedList

Constructor

new LinkedList()

Linked list.
Source:

Methods

hasCycle() → {Boolean}

Check if linked list contains cycle.
Source:
Returns:
Returns true if linked list contains cycle.
Type
Boolean

inorder(cb)

In order traversal of the linked list.
Parameters:
Name Type Description
cb function Callback which should be executed on each node.
Source:

pop() → {Node}

Return last node from the linked list.
Source:
Returns:
Last node.
Type
Node

push(data)

Add data to the end of linked list.
Parameters:
Name Type Description
data Object Data which should be added.
Source:

recursiveReverse()

Reverses the linked list recursively
Source:

remove(data) → {Boolean}

Remove data from the linked list.
Parameters:
Name Type Description
data Object Data which should be removed.
Source:
Returns:
Returns true if data has been removed.
Type
Boolean

reverse()

Reverses the linked list iteratively
Source:

shift() → {Node}

Return first node from the linked list.
Source:
Returns:
First node.
Type
Node

unshift(data)

Add data to the beginning of linked list.
Parameters:
Name Type Description
data Object Data which should be added.
Source: