Question: Consider the following function: 01: void cpUniq (const int* source, int N, vector & dest) 02: { 03: list L; 04: for (int i =

Consider the following function:

01: void cpUniq (const int* source, int N, vector& dest) 02: { 03: list L; 04: for (int i = 0; i < N; ++i) 05: { 06: copy (source, source + i, front_inserter(L)); 07: } 08: for (int j: L) 09: { 10: if (find(dest.begin(), dest.end(), j) != dest.end()) 11: dest.push_back(j); 12: } 13: } 

and the following list of complexity values:

A: O(1), B: O(log N), C: O(N), D: O(N log N), E: O(N2), F: O(N3), G: O(N4)

For each of the ranges of line numbers below, enter the letter code (A-G) of the closest correct complexity for that range of lines or X if none of the options is correct.

Assume that dest is empty when the function is called.

Line 3: [l3] Line 6: [l6] Lines 4-7: [l47] Line 11: [l11] Line 10: [l10] Lines 10-11: [l1011] Lines 8-12: [l812] Lines 2-13: [l213]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!