Class: LinkedList

LinkedList

Methods

hasCycle(){Boolean}

Check if linked list contains cycle.

Returns: {Boolean} Returns true if linked list contains cycle.

inorder(callback)

In order traversal of the linked list.

Parameters:
Name Type Description
callback function

Callback which should be executed on each node.

pop(){NodeStructure}

Return last node from the linked list.

Returns: {NodeStructure} Last node.

push(data)

Add data to the end of linked list.

Parameters:
Name Type Description
data Object

Data which should be added.

recursiveReverse()

Reverses the linked list recursively

remove(data){Boolean}

Remove data from the linked list.

Parameters:
Name Type Description
data Object

Data which should be removed.

Returns: {Boolean} Returns true if data has been removed.

reverse()

Reverses the linked list iteratively

shift(){NodeStructure}

Return first node from the linked list.

Returns: {NodeStructure} First node.

unshift(data)

Add data to the beginning of linked list.

Parameters:
Name Type Description
data Object

Data which should be added.