Title: ??? (tree)
1????????????
2??? (tree)
3??
- ???
- ???
- ???????
- ?,??,?
- ??,??,??,??
- ????????
- ?????
- ????
- ???????
4???(graph)
- ??????(node, ??, vertex)?,???(edge, ?,
?)????????? - V ?????
- E ????
- G ???
v1
??
? (?) e (v1, v2)
v2
5???????????
- ?????
- (undirected graph)
- ????????????
- (v1, v2) (v2, v1)
- ?????
- (directed graph, digraph)
- ???????????
- (v1, v2) ? (v2, v1)
v2
v1
v2
v2
v1
v1
???
6?????(complete graph)
7?????(subgraph)
- ???G (V, E)???,V?V, E?E???G(V,
E)?????????,G?G????????????
8??(path)
- v1?? v3????????? P v1, v2,v3
- v1?? v4??????????
- ??P v1, v2,v3??????????????
- ??P v1, v2,v3,v1?????????????????????????????
9??????????
???4? ??7? ????2????? ????????? ??????????
???4? ??7? ????2????? ????????? ??????????????
10?????(connected graph)
- ????????2??????????????????
- ?????????????????
11????(rooted tree)
- ??????1??????????????????????????????? ????
(rooted tree)????? ? (tree)???
12?(Tree)
? leaf
? root
13?????????
?(root)
?(branch)
??(node)
?(leaf)
14????(hierarchical structure)
A??
B??
C??
D??
E??
F??
G??
H??
I???
15?????? (p.39 ?2.16)
16??????? (p.42)
- (1) ??????,?????????
- (1) ??????(???(null tree)?)
- (2)
- (3) ??????,(1)????(2)????????????
Ti ? ni ?Ti?? n ????ni?? ???????? Ti???????
?? n???????
n
17??
a
- ??????????
- ?????.
- (????????,????????????)
- ????????????(graph)???
-
c
b
d
e
f
g
h
18????
a, b, ????node???
a
- ????
- a ? b, f ??(parent)
- b, f ? a ??(child)
b
f
c
d
g
i
e
h
19??
a
- ???????????(sibling)???
- b ? f ???
- c ? d ? e ???
- g ? i ???
b
f
c
d
g
i
e
h
20????????
- n1,n2,,nk ?????????????,1?iltk????ni
?ni1??????????,??????????n1????nk
????(path)????. - ????,?????? k -1
- ????????????0
n1
n2
n3
21?????
- ??a????b?????????,a?b???(ancestor),b?a???(descenda
nt)?????? - ????????????????????
- ?????????????????,???????
22?1 ?????
a
- a??h????
- a, f, g, h
- ???????
- 3
- f???
- f, g, h, i
- f?????
- g, h, i
b
f
c
d
e
g
i
h
23?2 ??
a
- c???
- a, b, c
- c?????
- a, b
- ?(root)
- ???????????????
- ?(leaf)
- ????????????
b
f
c
d
e
g
i
h
24?????
- ?????(height)
- ??????????????
- ????
- ??????
- ?????(level, depth)
- ???????????????
25?3 ?????
??(???)0
a
- ??b
- ??1,??1
- ??g
- ??1,??2
- ????
- 3
b
f
c
d
e
g
i
h
26????????
- ???(ordered tree)?????????????
- ????(unordered tree)??????????
??????????,???
?????????,???? ? b??,c?? ? c??,b??
27?????
(?1)????S????Q???????????????????,????S?????Q?????
???????????????????. ??,x??????????
Push(C, S)?Push(A, S)?Enq (Pop(S), Q)?Enq
(E,Q)? Push(Deq (Q),S)?Enq (D ,Q) ? x ? Deq (Q)
(?2)???3????,???????????????????????.
??????????