This is particularly useful if you are using a programming language that does not allow pointers to pointers (e.g. Java).
Inserting a node at the head of the list is a special case, since you have to alter the head link, whereas any other insertions alter the "next" field of some Node object.
Here are our three examples:
To see versions that use pointers to links, follow this link.
I've rewritten each to eliminate the use of pointers to links.
In each case insertion at the head is a special case.
© Theodore S. Norvell 1996--2004.