1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
densk [106]
1 year ago
15

Below functions flatten the nested list of integers (List[List[int]]) into a single list and remove duplicates by leaving only t

he 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.
f1 = f3 < f2
f1 = f2 < f3
f3 < f1 = f2
f3 < f1 < f2
f1 = f2 = f3

Computers and Technology
1 answer:
dusya [7]1 year ago
6 0

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

<h3>How to compare the time complexities?</h3>

The time complexities of the functions are dependent on the loops and conditional statements in the function.

From the given code, we have the following highlights:

  • 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

Considering the function f2

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 means that:

f2 > f1 and f2 > f3

Functions f1 and f3 have equal loops and conditional statement.

This means that

f1 = f3

So, we have:

f2 > f1 = f3

Rewrite as:

f1 = f3 < f2

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

Read more about time complexities at:

brainly.com/question/15549566

#SPJ1

You might be interested in
Write two statements to read in values for birthMonth followed by birthYear, separated by a space. Write a statement to print th
Ede4ka [16]

Answer:

// here is code in the C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main() {

// variable to store the input

int birth_month,birth_year;

cout<<"enter birth month:";

// read the birth month

cin>>birth_month;

cout<<"enter birth year:";

// read the birth year

cin>>birth_year;

// print the output

cout<<birth_month<<"/"<<birth_year<<endl;

return 0;

}

Explanation:

Declare two variables to store the birth month and birth year.Read the inputs from the user and assign it the variables.Print the birth month and year separated by a slash "/".

Output:

enter birth month:1                                                                                                        

enter birth year:2000                                                                                                      

1/2000

5 0
2 years ago
2.4 Code Practice: Question 2
klasskru [66]

num = float(input("Enter a number: "))

num1 = int(num)

print(num - num1)

I hope this helps!

8 0
2 years ago
Write a recursive method to form the sum of two positive integers a and b. Test your program by calling it from a main program t
77julia77 [94]

Answer:

see the code snippet below writing in Kotlin Language

Explanation:

fun main(args: Array<String>) {

   sumOfNumbers()

}

fun sumOfNumbers(): Int{

   var firstNum:Int

   var secondNum:Int

   println("Enter the value of first +ve Number")

   firstNum= Integer.valueOf(readLine())

   println("Enter the value of second +ve Number")

   secondNum= Integer.valueOf(readLine())

   var sum:Int= firstNum+secondNum

  println("The sum of $firstNum and $secondNum is $sum")

   return sum

}

5 0
3 years ago
List down any 5 Advantages and any 5 Disadvantages of Computers
Dahasolnce [82]

Advantages

Increase your productivity. ...

Connects you to the Internet. ...

Can store vast amounts of information and reduce waste. ...

Helps sort, organize, and search through information. ...

Get a better understanding of data. ...

Keeps you connected. ...

Help you learn and keep you informed. ...

Can make you money.

Disadvantages

Too much sitting. ...

Carpal tunnel and eye strain. ...

Short attention span and too much multitasking. ...

Potential of loss of privacy. ...

Can limit learning and create a dependency. ...

Time sink and lots of distractions....

5 0
2 years ago
Read 2 more answers
Can anyone help my please
Makovka662 [10]

order: soil, plant seeds, water, seedling, corn plant

4 0
1 year ago
Read 2 more answers
Other questions:
  • Disk scheduling algorithms in operating systems consider only seek distances, because Select one: a. modern disks do not disclos
    13·1 answer
  • Explain possible consequences if someone is issued with a fraudulent licence
    6·1 answer
  • What is the rationale behind the development of an operating system in computing?
    15·1 answer
  • The computer addicts are conscious about their addiction. True or false
    9·1 answer
  • With which type of social engineering attack are users asked to respond to an email or are directed to a website where they are
    9·1 answer
  • "What is the difference between dialogue and debate?
    7·1 answer
  • Create a function names minElement() that takes an array of numbers as a paaramter and returns the min value of the array. The a
    9·1 answer
  • Item 8 Item 8 Shelby Black runs a very successful hair salon in downtown Los Angeles. One of Shelby’s tasks is to input positive
    13·1 answer
  • Do u have to divide or multiply this problem 5300 yd = mi
    9·1 answer
  • What is the difference between Remote Assistance and Remote Desktop?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!