mirror of
https://github.com/ParkMoonJ/KaoYan.git
synced 2026-06-18 09:47:19 +08:00
Commit 6
This commit is contained in:
@@ -42,22 +42,7 @@
|
||||
|
||||
### 6.1① 已知一棵树边的集合为 $\{ <I, M>, <I, N>, <E, I>, <B, E>, <B, D>, <A, B>, <G, J>, <G, K>, <C, G>, <C, F>, <H, L>, <C, H>, <A, C> \}$,请画出这棵树,并回答下列问题:
|
||||
|
||||
```mermaid
|
||||
graph TB
|
||||
A --- B
|
||||
A --- C
|
||||
B --- D
|
||||
B --- E
|
||||
C --- F
|
||||
C --- G
|
||||
C --- H
|
||||
E --- I
|
||||
G --- J
|
||||
G --- K
|
||||
H --- L
|
||||
I --- M
|
||||
I --- N
|
||||
```
|
||||
<img src="assets/6.19.png">
|
||||
|
||||
#### (1)哪个是根结点?
|
||||
|
||||
@@ -158,8 +143,8 @@ $$
|
||||
| :-------------: | :---------------: | :---------------: | :---------------: |
|
||||
| $n$ 在 $m$ 左方 | 1 | 1 | 1 |
|
||||
| $n$ 在 $m$ 右方 | 0 | 0 | 0 |
|
||||
| $n$ 是 $m$ 祖先 | 1 | φ | φ |
|
||||
| $n$ 是 $m$ 子孙 | 1 | φ | φ |
|
||||
| $n$ 是 $m$ 祖先 | 1 | φ | 0 |
|
||||
| $n$ 是 $m$ 子孙 | 0 | φ | 1 |
|
||||
|
||||
> 注:如果 ① 离 a 和 b 最近的共同祖先 p 存在,且 ② a 在 p 的左子树中,b 在 p 的右子树中,则称 a 在 b 的左方(即 b 在 a 的右方)。
|
||||
|
||||
@@ -167,10 +152,7 @@ $$
|
||||
|
||||
#### (a)它们在先序遍历和中序遍历时,得到的结点访问序列相同;
|
||||
|
||||
```mermaid
|
||||
graph TB
|
||||
1(1)
|
||||
```
|
||||
<img src="assets/6.14.a.png">
|
||||
|
||||
#### (b)它们在后序遍历和中序遍历时,得到的结点访问序列相同;
|
||||
|
||||
|
||||
11
408/数据结构/6 树和二叉树/assets/6.14.a.dot
Normal file
11
408/数据结构/6 树和二叉树/assets/6.14.a.dot
Normal file
@@ -0,0 +1,11 @@
|
||||
graph a {
|
||||
splines="FALSE";
|
||||
|
||||
/* Entities */
|
||||
1[shape = circle]
|
||||
|
||||
/* Relationships */
|
||||
1
|
||||
|
||||
/* Ranks */
|
||||
}
|
||||
BIN
408/数据结构/6 树和二叉树/assets/6.14.a.png
Normal file
BIN
408/数据结构/6 树和二叉树/assets/6.14.a.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
36
408/数据结构/6 树和二叉树/assets/6.19.dot
Normal file
36
408/数据结构/6 树和二叉树/assets/6.19.dot
Normal file
@@ -0,0 +1,36 @@
|
||||
graph 6.19 {
|
||||
splines="FALSE";
|
||||
|
||||
/* Entities */
|
||||
A [shape = circle]
|
||||
B [shape = circle]
|
||||
C [shape = circle]
|
||||
D [shape = circle]
|
||||
E [shape = circle]
|
||||
F [shape = circle]
|
||||
G [shape = circle]
|
||||
H [shape = circle]
|
||||
I [shape = circle]
|
||||
J [shape = circle]
|
||||
K [shape = circle]
|
||||
L [shape = circle]
|
||||
M [shape = circle]
|
||||
N [shape = circle]
|
||||
|
||||
/* Relationships */
|
||||
A -- B
|
||||
A -- C
|
||||
B -- D
|
||||
B -- E
|
||||
C -- F
|
||||
C -- G
|
||||
C -- H
|
||||
E -- I
|
||||
G -- J
|
||||
G -- K
|
||||
H -- L
|
||||
I -- M
|
||||
I -- N
|
||||
|
||||
/* Ranks */
|
||||
}
|
||||
BIN
408/数据结构/6 树和二叉树/assets/6.19.png
Normal file
BIN
408/数据结构/6 树和二叉树/assets/6.19.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
29
408/数据结构/6 树和二叉树/assets/6.3.dot
Normal file
29
408/数据结构/6 树和二叉树/assets/6.3.dot
Normal file
@@ -0,0 +1,29 @@
|
||||
graph 6.3 {
|
||||
subgraph A {
|
||||
subgraph Aa{
|
||||
Aa1[label = "", shape = circle]
|
||||
Aa2[label = "", shape = circle]
|
||||
Aa3[label = "", shape = circle]
|
||||
|
||||
Aa1--Aa2--Aa3
|
||||
}
|
||||
subgraph Ab{
|
||||
Ab1[label = "", shape = circle]
|
||||
Ab2[label = "", shape = circle]
|
||||
Ab3[label = "", shape = circle]
|
||||
|
||||
Ab1--Ab2
|
||||
Ab1--Ab3
|
||||
}
|
||||
}
|
||||
subgraph B {
|
||||
subgraph Ba{
|
||||
Ba1[label = "", shape = circle]
|
||||
Ba1[label = "", shape = circle]
|
||||
Ba2[label = "", shape = circle]
|
||||
Ba3[label = "", shape = circle]
|
||||
|
||||
Ba1--Ba2--Ba3
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user