Below functions flatten the nested list of integers (List[List[int]]) into a single list and remove duplicates by leaving only the first occurrences. When the total number of elements is N, choose the one that correctly compares the time complexity with respect to N of each function.

Respuesta :

The time complexities of the functions is (a) f1 = f3 < f2

How to compare the time complexities?

The code of the functions f1, f2 and f3 are added as an attachment

To compare the time complexities of the functions, we check the loop and conditional statement in each function.

From the attached code, we can see that:

  • Function f1: 2 loops and 1 conditional statement
  • Function f2: 2 loops and 1 conditional statement in the second loop
  • Function f3: 2 loops and 1 conditional statement

In function f2, we have:

The conditional statement in the second loop implies that the conditional statement would be executed several times as long as the loop is valid.

This implies that:

f2 > f1 and f2 > f3

The number of loops and conditional statement in functions f1 and f3 are equal

This means that

f1 = f3

So, we have:

f2 > f1 = f3

Rewrite f2 > f1 = f3 as:

f1 = f3 < f2

Hence, the time complexities of the functions is (a) f1 = f3 < f2

Read more about time complexities at:

https://brainly.com/question/15549566

#SPJ1

Ver imagen MrRoyal