1. 初始化一個雙向鏈表。

2. 具體方法插入,每個節點可以存在如下結構:
struct node_each node{ int data; struct node_each *prev; struct node_each *next; };
A. 頭插入法

代碼思路:
{ D->next = head; //M2 head->prev = D; //M1 head = D; }
B 尾插入法

代碼思路:
{
//body -> C if (body->next == NULL) { body->next = D; //M1 D->prev = body; //M2 } }
C 中間插入法

代碼思路:
{ if (body->next == NULL) { //print nothing } else { //A as body after D body->next-prev = D; //M2 D->next = body->next; //M1 body->next = D; //M4 D->prev = body;//M3 } }
把每一條鏈都補全,代碼迎刃而解。
