- Page 1: Algorithms Copyright c○2006 S. Da
- Page 4 and 5: 4 Paths in graphs 109 4.1 Distances
- Page 8 and 9: Why P and NP? . . . . . . . . . . .
- Page 10 and 11: and excursions for the mathematical
- Page 12 and 13: Since then, this decimal positional
- Page 14 and 15: £¢¡ §¦ ¥¤ Figure 0.1 The pro
- Page 16 and 17: Figure 0.2 Which running time is be
- Page 18 and 19: Exercises 0.1. In each of the follo
- Page 21 and 22: Chapter 1 Algorithms with numbers O
- Page 23 and 24: of this sum gets computed in a fixe
- Page 25 and 26: Figure 1.2 Division. function divid
- Page 27 and 28: Taken together with the substitutio
- Page 29 and 30: Figure 1.5 Euclid’s algorithm for
- Page 31 and 32: Proof. The first thing to confirm i
- Page 33 and 34: 1.3 Primality testing Is there some
- Page 35 and 36: The set {1, 2, . . . , N − 1} b a
- Page 37 and 38: long. What makes this task quite ea
- Page 39 and 40: Alice and Bob are worried that the
- Page 41 and 42: The security of AES has not been ri
- Page 43 and 44: entries, the vast majority of them
- Page 45 and 46: Let us now prove the preceding prop
- Page 47 and 48: 1.15. Determine necessary and suffi
- Page 49 and 50: (d) Unlike Fermat’s Little theore
- Page 51 and 52: Chapter 2 Divide-and-conquer algori
- Page 53 and 54: Figure 2.1 A divide-and-conquer alg
- Page 55 and 56: Figure 2.3 Each problem of size n i
- Page 57:
Figure 2.4 The sequence of merge op
- Page 60 and 61:
2.4 Medians The median of a list of
- Page 62 and 63:
This follows by taking expected val
- Page 64:
2.6 The fast Fourier transform We h
- Page 67 and 68:
2.6.1 An alternative representation
- Page 69 and 70:
The original problem of size n is i
- Page 71 and 72:
Figure 2.7 The fast Fourier transfo
- Page 73 and 74:
Figure 2.8 The FFT takes points in
- Page 75 and 76:
Figure 2.9 The fast Fourier transfo
- Page 77 and 78:
¡ £¢ ¥¤ §¦ ©¨ #" %
- Page 79 and 80:
Exercises 2.1. Use the divide-and-c
- Page 81 and 82:
2.12. How many lines, as a function
- Page 83 and 84:
2.24. On page 62 there is a high-le
- Page 85:
(a) Show that the following rule is
- Page 88 and 89:
Figure 3.1 (a) A map and (b) its gr
- Page 90 and 91:
Figure 3.2 Exploring a graph is rat
- Page 92 and 93:
Figure 3.4 The result of explore(A)
- Page 94 and 95:
Figure 3.7 DFS on a directed graph.
- Page 96 and 97:
Figure 3.8 A directed acyclic graph
- Page 98 and 99:
Figure 3.9 (a) A directed graph and
- Page 100 and 101:
to successively output the second s
- Page 102 and 103:
(i) A (ii) B E C F D A B C D E F G
- Page 104 and 105:
3.17. Infinite paths. Let G = (V, E
- Page 106 and 107:
3.28. In the 2SAT problem, you are
- Page 108 and 109:
108
- Page 110 and 111:
Figure 4.2 A physical model of a gr
- Page 112 and 113:
Figure 4.5 Edge lengths often matte
- Page 114 and 115:
More generally, at any given moment
- Page 116 and 117:
Figure 4.9 A complete run of Dijkst
- Page 118 and 119:
Initialize dist(s) to 0, other dist
- Page 120 and 121:
4.5 Priority queue implementations
- Page 122 and 123:
Figure 4.12 Dijkstra’s algorithm
- Page 124 and 125:
Figure 4.14 The Bellman-Ford algori
- Page 126 and 127:
Exercises 4.1. Suppose Dijkstra’s
- Page 128 and 129:
Figure 4.16 Operations on a binary
- Page 130 and 131:
4.19. Generalized shortest-paths pr
- Page 132 and 133:
132
- Page 134 and 135:
Output: A tree T = (V, E ′ ), wit
- Page 136 and 137:
£¢ ¡ ©¨ Figure 5.2 T ∪ {e}
- Page 138 and 139:
Figure 5.4 Kruskal’s minimum span
- Page 140 and 141:
Figure 5.6 A sequence of disjoint-s
- Page 142 and 143:
compression) only touch the insides
- Page 144 and 145:
£¢ ¡ ©¨ Figure 5.8 Prim’s
- Page 146 and 147:
5.2 Huffman encoding In the MP3 aud
- Page 148 and 149:
f 1 + f 2 f 5 f 4 f 1 f 2 f 3 The l
- Page 150 and 151:
Entropy The annual county horse rac
- Page 152 and 153:
while there is an implication that
- Page 154 and 155:
e −x 1 − x 0 1 x Thus n t ≤ n
- Page 156 and 157:
5.7. Show how to find the maximum s
- Page 158 and 159:
(b) Now consider arbitrary distribu
- Page 160 and 161:
5.28. A prefix-free encoding of a f
- Page 162 and 163:
left-to-right order of Figure 6.1,
- Page 164 and 165:
same bookkeeping device we used for
- Page 166 and 167:
Figure 6.3 The subproblem E(7, 5).
- Page 168 and 169:
Figure 6.5 The underlying dag, and
- Page 170 and 171:
Of mice and men Our bodies are extr
- Page 172 and 173:
K(0) = 0 for w = 1 to W : K(w) = ma
- Page 174 and 175:
Figure 6.6 A × B × C × D = (A ×
- Page 176 and 177:
Figure 6.8 We want a path from s to
- Page 178 and 179:
Figure 6.9 The optimal traveling sa
- Page 180 and 181:
Figure 6.10 The largest independent
- Page 182 and 183:
Give an efficient algorithm to comp
- Page 184 and 185:
maximum sum of selling prices. You
- Page 186 and 187:
6.22. Give an O(nt) algorithm for t
- Page 188 and 189:
6.30. Reconstructing evolutionary t
- Page 190 and 191:
Figure 7.1 (a) The feasible region
- Page 192 and 193:
Figure 7.2 The feasible polyhedron
- Page 194 and 195:
How can we handle the fluctuations
- Page 196 and 197:
andwidth is exceeded and that each
- Page 198 and 199:
We will now show that these various
- Page 200 and 201:
Figure 7.4 (a) A network with edge
- Page 202 and 203:
c f : { cuv − f uv if (u, v) ∈
- Page 204 and 205:
Figure 7.6 The max-flow algorithm a
- Page 206 and 207:
Figure 7.7 An edge between two peop
- Page 208 and 209:
Figure 7.9 By design, dual feasible
- Page 210 and 211:
When the primal is the LP that expr
- Page 212 and 213:
to announce his or her strategy in
- Page 214 and 215:
Figure 7.12 A polyhedron defined by
- Page 216 and 217:
u y 2 y 1 x Specifically, if one of
- Page 218 and 219:
7.6.3 Loose ends There are several
- Page 220 and 221:
220
- Page 222 and 223:
Linear programming in polynomial ti
- Page 224 and 225:
Another parting thought: by what ot
- Page 226 and 227:
(b) Graph the feasible region, give
- Page 228 and 229:
ingredient energy protein fat carbo
- Page 230 and 231:
1 A 2 S 1 T 3 B 1 (a) Write the pro
- Page 232 and 233:
(b) Show that the fattest s − t p
- Page 234 and 235:
The story of Sissa and Moore Accord
- Page 236 and 237:
Figure 8.1 The optimal traveling sa
- Page 238 and 239:
This graph has multiple edges betwe
- Page 240 and 241:
further cut would then be needed to
- Page 242 and 243:
special case in which E consists of
- Page 244 and 245:
Why P and NP? Okay, P must stand fo
- Page 246 and 247:
Figure 8.6 The space NP of all sear
- Page 248 and 249:
RUDRATA (s, t)-PATH Instance: G = (
- Page 250 and 251:
It is usually cleaner to prove the
- Page 252 and 253:
p 1 b 0 g 0 p 0 p 2 g 1 b 1 p 3 Sup
- Page 254 and 255:
ZOE−→SUBSET SUM This is a reduc
- Page 256 and 257:
Figure 8.11 Reducing ZOE to RUDRATA
- Page 258 and 259:
Figure 8.12 A gadget for enforcing
- Page 260 and 261:
Figure 8.13 An instance of CIRCUIT
- Page 262 and 263:
Unsolvable problems At least an NP-
- Page 264 and 265:
(a) Show that if each literal appea
- Page 266 and 267:
EXPERIMENTAL CUISINE Input: n, the
- Page 268 and 269:
268
- Page 270 and 271:
Unfortunately, this approach does n
- Page 272 and 273:
Figure 9.1 Backtracking reveals tha
- Page 274 and 275:
Figure 9.2 (a) A graph and its opti
- Page 276 and 277:
Figure 9.3 A graph whose optimal ve
- Page 278 and 279:
Figure 9.5 Some data points and the
- Page 280 and 281:
By the triangle inequality, these b
- Page 282 and 283:
• Finally, there is another class
- Page 284 and 285:
Figure 9.7 (a) Nine American cities
- Page 286 and 287:
Figure 9.9 An instance of GRAPH PAR
- Page 288 and 289:
epeat randomly choose a solution s
- Page 290 and 291:
Figure 9.11 Simulated annealing. Th
- Page 292 and 293:
9.6. In the MINIMUM STEINER TREE pr
- Page 294 and 295:
294
- Page 296 and 297:
Figure 10.1 An electron can be in a
- Page 298 and 299:
Entanglement ∣ 〉 ∣ 〉 Suppos
- Page 300 and 301:
the hidden pattern. All this probab
- Page 302 and 303:
Input: A superposition of m = log M
- Page 304 and 305:
Let’s make this more precise. Lem
- Page 306 and 307:
FFT M (input: α 0 , . . . , α M
- Page 308 and 309:
Setting up a periodic superposition
- Page 310 and 311:
O(n 3 ) steps (as we saw in Section
- Page 312 and 313:
(d) Conclude therefore that for any
- Page 314 and 315:
Chapters 8 and 9 The notion of NP-c
- Page 316 and 317:
shortest path, 120, 157 disjoint se
- Page 318:
RSA cryptosystem, 39-40, 262 Rudrat