LinkedList

data-structures/linked-list. LinkedList

new LinkedList()

Linked list.
Source:

Methods

hasCycle() → {Boolean}

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

inorder(cb)

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

pop() → {Node}

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

push(data)

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

recursiveReverse()

Reverses the linked list recursively
Source:

remove(data) → {Boolean}

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

reverse()

Reverses the linked list iteratively
Source:

shift() → {Node}

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

unshift(data)

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