

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Main points of this past exam are: Multiplicative Inverse, Multiplicative, Solution, Equation, Integer, Prime, Asymptotically, N-Bit Integ, Post Order, Order Number
Typology: Exams
1 / 3
This page cannot be seen from the preview
Don't miss anything!


1 1. True: n log n ≤ n^2.
2 n log n =^ ∞.
n. That would be ≈ ln 2 n = Θ(^
1 n ).
2 1. N = 77 = pq for p = 7, q = 11. We have (p − 1)(q − 1) = 60 and d = 7−^1 mod 60. To calculate inverse of 7, we use Extended Euclid algorithm:
60 = 8 · 7 + 4 , 7 = 1 · 4 + 3 , 4 = 1 · 3 + 1.
Thus
1 = 4 − 1 · 3 = 4 − 1 · ( 7 − 1 · 4 )) = 2 · 4 + (−1) · 7 = 2 · ( 60 − 8 · 7 ) + (−1) · 7 = 2 · 60 + (−17) · 7.
Hence (−17) · 7 = 1 mod 60 and d = 7−^1 = −17 = 43 mod 60.
3 1. 1, i, −1, −i.
1 i − 1 −i 1 − 1 1 − 1 1 −i 1 i
i − 1 −i
1 4
1 −i − 1 i 1 − 1 1 − 1 1 i 1 −i
1 (^41) (^41) (^41) 4
4 1. Let u 1 ,... , uk be neighbors of u. Vertex u is on a cycle if and only if [pre(u 1 ), post(u 1 )],... , [pre(uk), post(uk)] are disjoint intervals. Proof : (⇒ part) If u is not on a cycle, then removing u partitions the graph into k subgraphs G 1 ,... , Gk such that ui ∈ V (Gi). DFS on u proceeds by first visiting u, then exploring G 1 completely, then exploring G 2 completely, and so on. Therefore pre(u 1 ) < post(u 1 ) < pre(u 2 ) < post(u 2 ) <... < pre(uk) < post(uk). (⇐ part) If [pre(ui), post(ui)] intersects [pre(uj ), post(uj )], then with- out loss of generality, we can assume pre(ui) < pre(uj ) < post(uj ) < post(uj ). This means that there is a path P from ui to uj that does not use vertex u. Therefore u is on the cycle (u, ui) + P + (uj , u).