Pseudocode for Inserting Nodes
Determine whether the new node will be the first node in the linked list. If so, then there is only one step:
head_insert(head_ptr, entry);
- Otherwise (if the new node will not be first):
- Set a pointer named previous_ptr to point to the node which is just before the new node's position.
head_insert(previous_ptr->link, entry);