LAST NAME:
FIRST NAME:
30 points total.
Note: * is times, ^ is exponentiation, + is plus, - is minus, / is division, all log's are base 2
(1) 2 points. Put the following in order from "smallest" to "greatest" - EXPSPACE, NP, P, EXP, PSPACE.
(2) 2 points each. For each of the following, say whether the problem is in P, NP, or EXP, and explain why (if in P, what is the polynomial time algorithm; if in NP, what is the polynomial time verifier/checker; if in EXP, how is the solution determined in exponential time).
2a. Shortest path: can you get from one vertex to another in a graph in a given number of steps.
2b. Longest path: is there a path that is at least a given number of steps from one vertex to another in a graph.
2c. Graph coloring: given a graph and a number k, can the graph be colored with k colors so that vertices that share an edge have different colors.
(3) 4 points. Given a message m, and public key n and e, how is the message encrypted in RSA? What is the running time as a function of the number of bits in m, n, ane e?
(4) 4 points. Whatever your project is, explain it in the space given here. First state what problem you are looking at, and give an example. Then explain what algorithm you are looking at, and some of the interesting properties of the algorithm (e.g., it is polynomial time, or it is really good on ___ type of inputs, or ...)
(5) 4 points. Pick a primality testing algorithm. Write down the name of it, and write down pseudocode for it. Then say what the running time of the algorithm is as a function of the number of bits?
(6) 3 points. Prove the following.
For any non-negative integer a and any positive integer b, gcd(a,b) = gcd(b, a mod b)
(7) 1 point each. Memorize formulas...
7a. 1 + 2 + 3 + 4 + ... + 300 =
7b. 1 + 2 + 4 + 8 + ... + 2^20 =
7c. log(2^16) =
7d. How many bits in 1 gigabyte?
7e. (10^4)^5 / (10^5) =
(8) 2 points. On your 1 gigahertz computer, how long does it take to do each of the following
8a. Run O(n) algorithm, for problem where n = 1 million
8b. Run O(n log(n)) algorithm, for problem where n = 1 million
8b. Run O(n^2) algorithm, for problem where n = 1 million
8c. Run O(n^3) algorithm, for problem where n = 1 million