The node Structure of a single-chain table is generally as follows:
Struct node {int val; node * Next ;};
Pay attention to the following when dealing with the basic operations of a single linked list:
1. Remember the header Node
Each operation on a single-chain table must start from the first node. If the header node in the function changes, such as inserting a node before the header node, deleting the header node, and reversing the linked list, you must update the header node. Otherwise, the linked list will be lost.
2. Check the end of the linked list continuously when you use a traversal link.
3. During insertion and deletion, you need to find the node before the insertion point or Deletion Point. Note that you must update the header node before inserting or deleting the header node.
4. fast and slow pointers are sometimes powerful tools.