Question: Consider the following code: 01: list folderol (int n) 02: { 03: set t, u: 05: 06: while (t.size() L: 11: for (int i: t)

Consider the following code: 01: list folderol (int n) 02: { 03: set t, u: 05: 06: while (t.size() L: 11: for (int i: t) 12: if (u.count(i) > 0) 13: L.push_back(i): 14: return L: 15: } 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(sqrt(n)) O(n) O(n log n) O(n sqrt(n)) O(n^2) O(n^2 log(n)) O(n^2 sqrt(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
