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
zloy xaker [14]
3 years ago
12

What is the f(n) runtime of the following pseudocode: sum = 0 for A = N/2 downto 1 for B = 1 to 4N increment sum by B

Mathematics
1 answer:
nikitadnepr [17]3 years ago
5 0

Answer:

f(N) = 2+ N/2 + 6N² units of time.

Step-by-step explanation:

Assigning 0 to the variable sum takes one unit of time.

Each time you increment sum by B, you need to call the value of sum, sum it to B and assign it to sum, which takes three units of time in total. You are repeating this process for each value of B which ranges from 1 to 4n and for each value of A which ranges from 1 to n/2. Opening the FOR takes also another unit of time, so, as a result, we have

f(N) 1 + 1 (open the FOR in A)+ N/2*(1 (open the FOR in B) + 4N*3) = 2+ N/2 + 6N² units of time. It has order complexity O(N²).

You might be interested in
The population of a school is 800 students and is increasing at a rate of 2% per year. If I want to use an exponential function
horrorfan [7]
You should value it at 2 plus 4
4 0
2 years ago
Solve for x: 2-3(2x-1)=-6x+5
horrorfan [7]

Answer:

x=-1

Step-by-step explanation:

1.) 2-3(2x-1)=-6x+5

2.) -1(-2x-1)=-6+5

3.) (2x+1)=-6+5

4.) (2x+1)=-1

5.) 2x=-2

6.) x=-1

3 0
3 years ago
Mrs. Brand spent $50 on a sewing project. She bought 4 yd. of material and $6 worth on notions. What is the price per yard that
Dmitry [639]
50 - 6 = 44

44/4 = 11

The price per yard is $11.


I hope that helped you! c:
6 0
3 years ago
Determine whether the given value is a solution of the equation. Show your work.
charle [14.2K]

Step-by-step explanation:

No Not an answer

21=x-5

x=26

6 0
3 years ago
Amy buys 22 envelopes for 13p each and pays with a £5 note.
katovenus [111]
Hi there lol have a great day
3 0
2 years ago
Other questions:
  • Explain how you could use the distributive property and mental math to find 5x198
    8·1 answer
  • It takes 27 pounds of seed to completely plant a 3-acre field. How many pounds of seed are needed per acre?
    12·1 answer
  • Based on the following set of data, which of the statements shown is true?
    8·2 answers
  • What is the amplitude of the sinusoid's graph? y = -4 sin 3x
    15·1 answer
  • 3 2/3 feet per 11//60 hour<br>It says find the unit rate
    11·1 answer
  • What is 602535 divisible by
    7·1 answer
  • 4267 divided by 31 in mixed number form
    12·1 answer
  • What is the decay factor in the exponential decay function y=a (1-r) t
    7·1 answer
  • How many cards does each friend have? See image below
    12·1 answer
  • 7
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!