Question: Consider the following code: list folderol (int n) { unordered_set t, u: while (t.size() L: for (int i: t) if (u.count(i) > 0) L.push_back(i): return

Consider the following code: list folderol (int n) { unordered_set t, u: while (t.size() L: for (int i: t) if (u.count(i) > 0) L.push_back(i): return L: rand() returns a random non-negative integer and runs in 'O(1)' time. Assume that each possible unsigned int value is equally likely to be returned on any given call to rand(). Match the line numbers below to the closest correct complexity expression, giving the single-letter identifier for your chosen complexity. O(1) O(log n) O( squareroot (n)) O(n) O(n log n) O(n squareroot (n)) O(n^2) O(n^2 log(n)) O(n^2 squareroot (n)) O(n^3) none of these If the line numbers are preceded by "Avg", give the average case complexity. Otherwise, give the worst case complexity. Line 7: _______ Avg Line 7: _______ Lines 6-7: _______ Line 13: _______ Line 12: _______ Avg Line 12: _______ Lines 11-13: _______ Avg Lines 11-13: _______ Line 14: _______ Avg Line 14: ________
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
