跳到主要内容

数据结构

线性表

L=(a1,a2,,an)原子元素 可变长度L=(a_1,a_2,\cdots,a_n) \\ \text{原子元素} \space \text{可变长度}\le

顺序表

LOC(an)=LOC(an1)+1LOC(a_n)=LOC(a_{n-1})+1

单向链表

Head[Data][Next*,]Head \to [\text{Data}][\text{Next*},\wedge]

双向链表

Head[Prev*][Data][Next*,]Head \to [\text{Prev*}][\text{Data}][\text{Next*},\wedge]

循环链表

Head[Data][Next*,First*]Head \to [\text{Data}][\text{Next*},\text{First*}]

静态链表

L(a1,a2,a3)    A[a1a2a3]固定长度L(a_1,a_2,a_3) \iff A\begin{bmatrix} a_1 & a_2 & a_3\end{bmatrix} \\ \text{固定长度}

数组

Amn=[a11a1nam1amn]A_{m*n}=\begin{bmatrix}a_{11} & \cdots & a_{1n} \\ \vdots & \ddots & \vdots \\ a_{m1} & \cdots & a_{mn}\end{bmatrix} 同构元素 固定长度\\\text{同构元素} \space \text{固定长度}

行主序

a11a1nrow1 am1amnrowm\underbrace{\boxed{a_{11}}\cdots\boxed{a_{1n}}}_{\text{row}_1} \cdots \space \cdots \underbrace{\boxed{a_{m1}}\cdots\boxed{a_{mn}}}_{\text{row}_m}

列主序

a11am1column1 an1amncolumnn\underbrace{\boxed{a_{11}}\cdots\boxed{a_{m1}}}_{\text{column}_1} \cdots \space \cdots \underbrace{\boxed{a_{n1}}\cdots\boxed{a_{mn}}}_{\text{column}_n}

S=(c1,c2,,cn)字符元素 可变长度S=(c_1,c_2,\cdots,c_n) \\ \text{字符元素} \space \text{可变长度}

顺序结构

LOC(cn)=LOC(cn1)+1LOC(c_n)=LOC(c_{n-1})+1

链式结构

Head[Data][Next*,]Head \to [\text{Data}][\text{Next*},\wedge] 字符元素 串元素\\ \text{字符元素} \space \text{串元素}

模式匹配

朴素

改进

广义表

LS=(a1,a2,,an)原子元素 表元素 元素共享 可递归(自包含)LS=(a_1,a_2,\cdots,a_n) \\ \text{原子元素} \space \text{表元素} \space \text{元素共享} \space \text{可递归(自包含)}

链表节点存储

表节点:[1][hp][tp]元素节点:[0][data]\text{表节点:[1][hp][tp]} \\ \text{元素节点:[0][data]}

LIFO\text{LIFO}

顺序栈

LOC(an)=LOC(an1)+1LOC(a_n)=LOC(a_{n-1})+1

链栈

top[Data][Next*,]top \to [\text{Data}][\text{Next*},\wedge]

队列

FIFO\text{FIFO}

循环队列

Fixed length:QsizeIn:Qrarenext=(Qrare+1)%QsizeOut:Qfrontnext=(Qfront+1)%Qsize\text{Fixed length:}Q_{size} \\ \text{In:}Q_{\stackrel{next}{rare}}=(Q_{rare}+1)\%Q_{size} \\ \text{Out:}Q_{\stackrel{next}{front}}=(Q_{front}+1)\%Q_{size}

链式结构

特殊矩阵

稀疏矩阵

顺序结构

三元组顺序表

链式结构

十字连表

有向图

无向图

二叉树

森林