Algorithms and Data Structures. . . . . .1/1 Algorithms and Data Structures 12th Lecture: Graph...
Transcript of Algorithms and Data Structures. . . . . .1/1 Algorithms and Data Structures 12th Lecture: Graph...
. . . . . . 1/1
Algorithms and Data Structures12th Lecture: Graph Algorithms II
Yutaka Watanobe, Jie Huang, Yan Pei,Wenxi Chen, Qiangfu Zhao, Wanming Chu
University of Aizu
Last Updated: 2020/12/1
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 2/1
Outline
Weighted GraphsMinimum Spanning TreeSingle-Source Shortest Paths
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 3/1
Adjacency Matrix Representation: UndirectedWeighted Graph
For a given connected, undirected graph G = (V ,E) where foreach edge (u, v) ∈ E , we have a weight w(u, v) specifying thecost to connect u and v .
0 1 2 3 4 5 6
0
1
2
3
4
5
6
∞ 8 12 3
8
12
3 7 23
7 -2
23 -2
1
0
2
3
6
5
4
j
i
8
12
3
7
23
-2
∞ ∞ ∞
∞ ∞ ∞
∞ ∞ ∞
∞ ∞ ∞
∞ ∞ ∞
∞ ∞ ∞ ∞
∞ ∞∞ ∞ ∞
∞ ∞ ∞
∞ ∞ ∞ ∞ ∞ ∞
∞ ∞
∞
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 4/1
Adjacency List Representation: Directed WeightedGraph
For a given connected, directed graph G = (V ,E) where for eachedge (u, v) ∈ E , we have a weight w(u, v) specifying the cost toconnect u and v .
1
0
2
3
6
5
4
6
12
7
8
3
53
1
0
10
1
2
3
4
5
6
2
4
3
2
5
5
36 12 7
8
3 53
1 0
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 5/1
Spanning Tree
(a) (b) (c)
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 6/1
Minimum Spanning Tree (1)
4
5
13
23
2
1
2
10
1
3
100
12
356
7 4
2
1
21
3
7
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 7/1
Minimum Spanning Tree (2)
We wish to find an acyclic subset T ⊆ E that connects all of thevertices and whose total weight
w(T ) =∑
(u,v)∈T
w(u, v)
is minimized.Since T is acyclic and connects all of the vertices, it must form atree, which we call a spanning tree.We call the problem of determining the tree T the minimumspanning-tree (MST) problem.
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 8/1
Minimum Spanning Tree (3)
b
h
c
g
d
f
ia e11
4
8
8 7
1 2
2
6
4
7
14
10
9
A minimum spanning tree for a connected graph.The weights on edges are shown, and the edges in a minimumspanning tree are shaded.The total weight of the tree is 37.
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 9/1
Growing a Minimum Spanning Tree (1)
Assume that we have a connected, undirected graph G = (V ,E)with a weight function w : E → R, and we wish to find a MST forG.We use a greedy approach. It is captured by the ”generic”algorithm, which grows the minimum spanning tree one edge ata time.The algorithm manages a set of edges T , maintaining thefollowing loop invariant:
Prior to each iteration, T is a subset of some minimum spanningtree.
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 10/1
Growing a Minimum Spanning Tree (2)
At each step, we determine an edge (u, v) that can be added toT without violating this invariant, in the sense that T ∪ {(u, v)} isalso a subset of a MST.We call such an edge a safe edge for T , since it can be safelyadded to T while maintaining the invariant.
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 11/1
Generic Algorithm for MST
genericMST(G, w)
T = empty
while T does not form a spanning tree
find an edge (u, v) that is safe for T
T = T ∪ {(u, v)}
return T
This is a “generic” algorithm which can be a basis to implementdifferent algorithms.
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 12/1
Prim’s Algorithm for MST
Prim’s algorithm is a special case of the generic MST algorithms.Prim’s algorithm has the property that the edges in the set Talways form a single tree.The tree starts from an arbitrary root vertex r and grows until thetree spans all the vertices in V .At each step, a light edge is added to the tree T that connects Tto an isolated vertex of GT = (V ,T ). This rule adds only edgesthat are safe for T .This strategy is greedy since the tree is augmented at each stepwith an edge that contributes the minimum amount possible tothe tree’s weight.
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 13/1
Prim’s Algorithm based on the Generic Algorithm (1)
b
h
c
g
d
f
ia e11
4
8
8 7
1 2
2
6
4
7
14
10
9
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 14/1
Prim’s Algorithm based on the Generic Algorithm (2)
b
h
c
g
d
f
ia e11
4
8
8 7
1 2
2
6
4
7
14
10
9
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 15/1
Prim’s Algorithm based on the Generic Algorithm (3)
b
h
c
g
d
f
ia e11
4
8
8 7
1 2
2
6
4
7
14
10
9
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 16/1
Prim’s Algorithm based on the Generic Algorithm (4)
b
h
c
g
d
f
ia e11
4
8
8 7
1 2
2
6
4
7
14
10
9
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 17/1
Prim’s Algorithm based on the Generic Algorithm (5)
b
h
c
g
d
f
ia e11
4
8
8 7
1 2
2
6
4
7
14
10
9
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 18/1
Prim’s Algorithm based on the Generic Algorithm (6)
b
h
c
g
d
f
ia e11
4
8
8 7
1 2
2
6
4
7
14
10
9
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 19/1
Prim’s Algorithm based on the Generic Algorithm (7)
b
h
c
g
d
f
ia e11
4
8
8 7
1 2
2
6
4
7
14
10
9
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 20/1
Prim’s Algorithm based on the Generic Algorithm (8)
b
h
c
g
d
f
ia e11
4
8
8 7
1 2
2
6
4
7
14
10
9
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 21/1
Prim’s Algorithm based on the Generic Algorithm (9)
b
h
c
g
d
f
ia e11
4
8
8 7
1 2
2
6
4
7
14
10
9
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 22/1
Prim’s Algorithm: Implementation
T T’
V - T V - T
u
v
v
v
v
v
Candidates
r r
Update
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 23/1
Prim’s Algorithm1
0
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
20
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
10
3
11
18
30
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
5
3
7
18
2
5
40
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
1
3
7
18
2
2
50
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
1
3
7
18
2
2
60
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
1
3
2
18
2
2
70
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
1
3
2
1
2
2
80
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
1
3
2
1
2
2
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 24/1
Prim’s Algorithm (1)
10
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 25/1
Prim’s Algorithm (2)
20
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
10
3
11
18
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 26/1
Prim’s Algorithm (3)
30
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
5
3
7
18
2
5
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 27/1
Prim’s Algorithm (4)
40
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
1
3
7
18
2
2
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 28/1
Prim’s Algorithm (5)
50
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
1
3
7
18
2
2
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 29/1
Prim’s Algorithm (6)
60
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
1
3
2
18
2
2
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 30/1
Prim’s Algorithm (7)
70
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
1
3
2
1
2
2
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 31/1
Prim’s Algorithm (8)
80
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
1
3
2
1
2
2
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 32/1
Prim’s Algorithm: O(|V |2) Implementation (1)
prim(G, w, r)
for each u in G
d[u] = inf
pi[u] = NIL
color[u] = WHITE
d[r] = 0
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 33/1
Prim’s Algorithm: O(|V |2) Implementation (2)
while true
mincost = inf
for each i in G
if color[i] != BLACK and d[i] < mincost
mincost = d[i]
u = i
if mincost == inf
break
color[u] = BLACK
for each v in Adj[u]
if color[v] != BLACK and w(u, v) < d[v]
pi[v] = u
d[v] = w(u, v)
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 34/1
Prim’s algorithm: ((|V |+ |E |) log |V |) Implementation(1)
prim(G, w, r)
for each u in G
d[u] = inf
pi[u] = NIL
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 35/1
Prim’s algorithm: ((|V |+ |E |) log |V |) Implementation(2)
For an efficient implementation, we use a min-heap H of vertices,keyed by their d values.
d[r] = 0
H = buildMinHeap(V)
while H is not empty
u = H.extractMin()
color[u] = BLACK
for each v in Adj[u]
if color[v] != BLACK
if w(u, v) < d[v]
pi[v] = u
d[v] = w(u, v)
heapDecreaseKey(H, v, w(u, v))
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 36/1
Single-Source Shortest Paths (1)
We are given a weighted, directed graph G = (V ,E), with weightfunction w : E → R mapping edges to real-valued weights.The weight of path p = {v0, v1, ..., vk} is the sum of the weights ofits constituent edges:
w(p) =k∑
i=1
w(vi−1, vi)
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 37/1
Single-Source shortest Paths (2)
We define the shortest-path weight from u to v by
δ(u, v) ={
min{w(p) : u → v} if there is a path from u to v∞ otherwise
A shortest path from vertex u to vertex v is then defined as anypath p with weight w(p) = δ(u, v).Given a graph G = (V ,E), we want to find a shortest path from agiven source vertex s ∈ V to each vertex v ∈ V .
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 38/1
Initialize
For each vertex v ∈ V , we maintain an attribute d [v ], which is anupper bound on the weight of a shortest path from source s to v .We call d [v ] a shortest-path estimate.We initialize the shortest-path estimates and predecessors bythe following procedure.
initializeSingleSource(G, s)
for each v in G
d[v] = inf
pi[v] = NIL
d[s] = 0
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 39/1
Relaxation
The process of relaxing an edge (u, v) consists of testingwhether we can improve the shortest path to v found so far bygoing through u and, if so, updating d [v ] and pi[v ].A relaxation step may decrease the value of the shortest-pathestimate d [v ] and update v ’s predecessor field pi[v ].
relax(u, v, w)
if d[v] > d[u] + w(u, v)
d[v] = d[u] + w(u, v)
pi[v] = u
u
s
v
w(u, v)
d[v]
d[u]
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 40/1
Dijkstra’s Algorithm for SSSP (1)
Dijkstra’s algorithm solves the single-source shortest-pathsproblem on a weighted, directed graph G = (V ,E) for the case inwhich all edge weights are nonnegative.Dijkstra’s algorithm maintains a set S of vertices whose finalshortest path weights from the source s have already beendetermined.
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 41/1
Dijkstra’s Algorithm for SSSP (2)
The algorithm repeatedly selects the vertex u ∈ V − S with theminimum shortest-path estimate, adds u to S, and relaxes alledges leaving u.
S S’
V - S V - S
u
v
v
v
v
v
Candidates
s s
Update
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 42/1
Dijkstra’s Algorithm: O(|V |2) Implementation
dijkstra(G, w, s)
initializeSingleSource(G, s)
while true
mincost = inf
for each i in G
if color[i] != BLACK and d[i] < mincost
mincost = d[i]
u = i
if mincost == inf
break
color[u] = BLACK
for each v in Adj[u]
if color[v] != BLACK and d[u] + w(u, v) < d[v]
pi[v] = u
d[v] = d[u] + w(u, v)
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 43/1
Dijkstra’s Algorithm: O((|V |+ |E |) log |V |)Implementation
For an efficient implementation, we use a min-heap H of vertices,keyed by their d values.
dijkstra(G, w, s)
initializeSingleSource(G, s)
H = buildMinHeap(V)
while H is not empty
u = H.extractMin()
color[u] = BLACK
for each v in Adj[u]
if color[v] != BLACK
if d[u] + w(u, v) < d[v]
d[v] = d[u] + w(u, v)
color[v] = GRAY
hepaDecreaseKey(H, v, d[u] + w(u, v))
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 44/1
Dijkstra’s Algorithm (1)
5
10
2
9
3
2
7
1∞
∞
∞
∞
0 4 6
u v
x y
s
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 45/1
Dijkstra’s Algorithm (2)
5
10
2
9
3
2
7
110
5
∞
∞
0 4 6
u v
x y
s
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 46/1
Dijkstra’s Algorithm (3)
5
10
2
9
3
2
7
18
5
14
7
0 4 6
u v
x y
s
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 47/1
Dijkstra’s Algorithm (4)
5
10
2
9
3
2
7
18
5
13
7
0 4 6
u v
x y
s
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 48/1
Dijkstra’s Algorithm (5)
5
10
2
9
3
2
7
18
5
9
7
0 4 6
u v
x y
s
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 49/1
Dijkstra’s Algorithm (6)
5
10
2
9
3
2
7
18
5
9
7
0 4 6
u v
x y
s
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 50/1
Dijkstra’s Algorithm: Another Example1
0
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
20
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
10
3
11
18
30
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
8
3
10
18
5
8
40
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
6
3
10
18
5
7
50
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
6
3
10
18
5
7
60
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
6
3
9
18
5
7
70
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
6
3
9
10
5
7
80
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
6
3
9
10
5
7
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 51/1
Dijkstra’s Algorithm: Another Example (1)
10
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 52/1
Dijkstra’s Algorithm: Another Example (2)
20
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
10
3
11
18
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 53/1
Dijkstra’s Algorithm: Another Example (3)
30
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
8
3
10
18
5
8
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 54/1
Dijkstra’s Algorithm: Another Example (4)
40
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
6
3
10
18
5
7
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 55/1
Dijkstra’s Algorithm: Another Example (5)
50
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
6
3
10
18
5
7
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 56/1
Dijkstra’s Algorithm: Another Example (6)
60
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
6
3
9
18
5
7
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 57/1
Dijkstra’s Algorithm: Another Example (7)
70
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
6
3
9
10
5
7
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 58/1
Dijkstra’s Algorithm: Another Example (8)
80
1
2 3
56
4
10
3
11
18
1
7
2
5
2
15
2
0
6
3
9
10
5
7
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures
. . . . . . 59/1
Reference
1 Introduction to Algorithms (third edition), Thomas H.Cormen,Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. TheMIT Press, 2012.
Y. Watanobe, J. Huang, Y. Pei, W. Chen, Q. Zhao, W. Chu University of Aizu
Algorithms and Data Structures