逻辑:
集合 线性表 树 图物理: 顺序 链式typedef struct Node{ ElmetType data; struct Node *next;}Node;头指针 : 链表的起始尾指针 : 链表的结束判空 : 头指针为空头结点 不存任何节点 head->next == NULL尾部插入 Node *r = malloc (sizeof(Node)); Node *p = head; while (p->next != NULL){ p = p->next; } p->next = r; 中间插入 //后插 Node *f = malloc(sizeof(Node)); Node *p = head->next; while (p->next != NULL){ if (p->data == ‘b’){ f->next = p->next; p->next = f; return ; } p = p->next; } 删除 Node *p = head; while (p->next != NULL){ if (p->next->data == ‘c’){ Node *n = p->next; p->next = n->next; n->next = NULL; free(n); return ; } p = p->next; }