1 bidirectional linked list storage structure for linear tables
struct Dulnode {elemtype data;
struct Dulnode *next;
struct Dulnode *prior;
} Dulnode;
typedef struct DULNODE *dullinklist;
2 since the single-linked list has a circular list, the doubly linked list also has a circular link list
A two-way loop linked list with an empty list of head nodes:
A non-empty linked list with a head node in a two-way circular list:
3 insert operation for doubly linked list, note to modify two pointer variables.
Suppose you want to insert an element s with a data of e between P and P->next.
S->prior = p;s->next = p->next;p->next->prior = s;p->next = s;
The above code must be aware of the order.
4 delete operation of the doubly linked list, note to modify two pointer variables.
P->prior->next = p->next;p->next->prior = p->prior;
Free (p);
Note to release p.
5 because each node of a doubly-linked list needs to record two pointers, it consumes more memory. However, the operation of the junction points is convenient. In other words, space is used to exchange time.
Doubly linked list