$18.99
Problem 0: exercise only; don’t turn in
Do Exercise 1 on page 415.
1 The shortest path algorithms
Run the two shortest path algorithms on the following two graphs. Show the steps needed to illustrate how the algorithms run.
1. Run Dijkastra’s algorithm for Figure 1(a). Use node s as the starting point.
2. Run Bellman-Ford algorithm for Figure 1(b). Use node z as the source, and compute the distance to each other node. We follow the lexicographical order when relaxing each edge in the graph: (u, v),(u, x),(u, y),(v, u),(x, v),(x, y),(y, v),(y, z),(z, u),(z, x).
(a) Run Dijkastra’s algorithm (b) Run Bellman-Ford algorithm
2 The shortest path problem
Suppose that we are given a weighted directed graph G = (V, E) where edges leaving the source node s may have negative weights, and all other edge weights are non-negative. And there are no negative-weight cycles. Now, argue that Dijkastra’s algorithm correctly finds the shortest paths from s in the graph.
3 A problem related to number theory
We pick two arbitrary prime numbers p and q. We let n = pq. We let e be a number that is relatively prime to (p − 1)(q − 1).
(i) First show there exists a number d such that 1 ≤ d < (p − 1)(q − 1), and ed ≡ 1 (mod
(p − 1)(q − 1)).
(ii) Then, show xed ≡ x (mod n) for any x ∈ {0, 1, 2, . . . n − 1}. Here, a fact about prime numbers may be useful: if an integer a is divided by two distinct prime numbers p and q, then a is divided by pq.
4 FFT
Now let us practice the polynomial multiplication by FFT. Suppose that you want to multiply the two polynomials 1 + x + 2x2 and 2 + 3x using the FFT. Choose an appropriate power of two, find the FFT of the two polynomials, and then multiply the results componentwise. You only need to give the value representation form for the resulting polynomial (i.e. you do not need to perform interpolation to obtain the coefficient representation).