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
Nikolay [14]
3 years ago
13

What is the f(n) runtime of the following pseudocode: sum-0 for A = N/2 downto 1 for B-1 t increment sum by B Explain: exactly w

hat is wrong with the following diagram why it is incorrect how to fix it NP NP- Complete
Computers and Technology
1 answer:
Romashka [77]3 years ago
3 0

The diagram part of the question is incomplete but the mathematical part has been solved below for you . However when the diagram will be attached it will be answered too.

Answer:

Following is the solution for the Time complexity/ Run Time:

Given that:

A = N/2 to 1

B = 1 to 4N

By summation:

Time Complexity = Lower bound of A * Upper Bound of B

Time Complexity = (N/2) * (4N)

By simplifying:

Time Complexity = N * 2N

Time Complexity = 2N^2

Hence the runtime f(n) for given pseudocode will be 2N^2

i hope it will help you!

You might be interested in
Answer this and you get free 100 points
Agata [3.3K]

Answer:

thanks my dude I needed it

5 0
3 years ago
Read 2 more answers
PLS HURRY!!<br> Look at the image below
Crank

The output will be 10.

The while loop runs until numb is equal to or less than 13.

25 - 5 = 20

20 - 5 = 15

15 - 5 = 10, which is less than 13 so the loop stops and 10 is printed to the screen.  

4 0
3 years ago
="Jack"&amp;"$"&amp;"Jill". What will be the output of this formula?​
natita [175]
I’m so confused on this but hey here’s this

3 0
2 years ago
Write a function addUpSquaresAndCubes that adds up the squares and adds up the cubes of integers from 1 to N, where N is entered
avanturin [10]

Answer:

All functions were written in python

addUpSquaresAndCubes Function

def addUpSquaresAndCubes(N):

    squares = 0

    cubes = 0

    for i in range(1, N+1):

         squares = squares + i**2

         cubes = cubes + i**3

    return(squares, cubes)

sumOfSquares Function

def sumOfSquares(N):

    squares = 0

    for i in range(1, N+1):

         squares = squares + i**2

    return squares

sumOfCubes Function

def sumOfCubes(N):

    cubes = 0

    for i in range(1, N+1):

         cubes = cubes + i**3

    return cubes

Explanation:

Explaining the addUpSquaresAndCubes Function

This line defines the function

def addUpSquaresAndCubes(N):

The next two lines initializes squares and cubes to 0

    squares = 0

    cubes = 0

The following iteration adds up the squares and cubes from 1 to user input

    for i in range(1, N+1):

         squares = squares + i**2

         cubes = cubes + i**3

This line returns the calculated squares and cubes

    return(squares, cubes)

<em>The functions sumOfSquares and sumOfCubes are extract of the addUpSquaresAndCubes.</em>

<em>Hence, the same explanation (above) applies to both functions</em>

7 0
3 years ago
PLEASE-I'M STUCK!!!!!!!!!!!!!!!!!!!!!!
Blababa [14]

Answer: Input is the answer.

8 0
3 years ago
Other questions:
  • Problem 1 (Authentication): Consider the following authentication protocol, which uses a classical cryptosystem. Alice generates
    5·1 answer
  • Which statements describe the advantages of using XML?
    12·2 answers
  • What is the name of the computer through which e-mail messages are sent and received?
    12·1 answer
  • U2- an example of __________ is an attempt by an unauthorized user to gain access to a system by posing as an authorized user.
    6·1 answer
  • Why was Apple the best company of 2019??
    15·2 answers
  • The database must be carefully planned to allow useful data manipulation and report generation.
    10·1 answer
  • When planning your website, what is one of the key things you should consider
    12·2 answers
  • Consider the system of simultaneous equations:
    15·1 answer
  • Why does it say error on that last line of code
    15·2 answers
  • How to convert binary to decimal <br> Please it’s so hard and what is digital and analogue
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!