206. 反转链表
2023/1/2大约 12 分钟
∅←ab⇆cd→∅
这里我们主要介绍的是链表中最复杂的结构:循环双向链表 (Circular Doubly Linked List)
数据结构:
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef int DataType;
typedef struct CDList {
DataType data;
struct CDList *prev; // 指向上一结点
struct CDList *next; // 指向下一结点
} Node;
这里的单链表是无头非循环的,与 数据结构 - 单链表 中介绍的一致,并使用到头文件: