C S 314 Midterm: Spring_2018_E2
Document Summary
Points off 1 2 3 4 5 total off. Shelby: there are 5 questions on this test. Scores will be scaled to 200 points: you have 2 hours to complete the test, place your final answers on this test. Place your answer on the line next to or under the question. For example, selection sort has an average case big o of o(n2), but per the formal definition of big o it is correct to say selection sort also has a big o of o(n3) or o(n4). Give the most restrictive, correct big o function. (closest without going under. : assume log2(1,000) = 10 and log2(1,000,000) = 20. ____________________ public static int a(int x) { if (x == 0) else return 5; return 3 + a(x - 3); The following method takes 5 seconds to complete when n = 500,000. ____________________ for (int j = math. min(10_000, n); j >= 0; j--) r += (double) j / (i + 1);