May 2017
Intermediate to advanced
340 pages
8h 16m
English
Deleting a node simply means taking out the node and rearranging the previous and subsequent node links. If we just remove a node and connect the previous node's next link with the node following the deleted node, we are done with the delete operation. Just have a look at the following example:

When we delete the first node, we just have to make the second node our head or first node. We can achieve that very easily by using the following code:
public function deleteFirst() { if ($this->_firstNode !== NULL) { if ($this->_firstNode->next !== NULL) { $this->_firstNode = $this->_firstNode->next; } else { $this->_firstNode ...Read now
Unlock full access