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
Scientists studying dolphin echolocation simulate the projection of a bottlenose dolphin's clicking sounds using computer
lina2011 [118]

Step-by-step explanation:

The equation of a parabola with focus at (h, k) and the directrix y = p is given by the following formula:

(y - k)^2 = 4 * f * (x - h)

In this case, the focus is at the origin (0, 0) and the directrix is the line y = -1.3, so the equation representing the cross section of the reflector is:

y^2 = 4 * f * x

  = 4 * (-1.3) * x

  = -5.2x

The depth of the reflector is the distance from the vertex to the directrix. In this case, the vertex is at the origin, so the depth is simply the distance from the origin to the line y = -1.3. Since the directrix is a horizontal line, this distance is simply the absolute value of the y-coordinate of the line, which is 1.3 inches. Therefore, the depth of the reflector is approximately 1.3 inches.

4 0
1 year ago
10 out of 85 students are left handed a my school if 391 students are at my school total how many students in my school at left
svet-max [94.6K]

Answer:

About 40 students are left handed

Step-by-step explanation:


3 0
3 years ago
70% of the 40 members of the club voted. how many voted ?
REY [17]

Answer:

28 members up in that club have voted.

6 0
3 years ago
Read 2 more answers
Peter uses unit cubes to build a figure in the shape of the letter X what is the fewest unit cubes that Peter can use to build t
lozanna [386]
I am not sure I am right but I think it depends on the size of the X.

4 0
3 years ago
(x-h+2)^3 <br><br> Simplify.
EleoNora [17]
X^3 - h^3 + 8 because you cube the variables as well as 2, and 2x2x2=8.
3 0
3 years ago
Other questions:
  • kendra needs 1/3 cup of nuts for a cake she ia baking .if she had 8 cups of nuts how many cakes could she make
    14·1 answer
  • Describe the pattern 2, 4, 9, 11, 16, 18, 23
    12·2 answers
  • PLS PLS HELP!!!!!! WILL MARK BRAINLIEST!!! :)
    10·2 answers
  • Which function passes through the points (2, 15) and (3, 26)?
    10·2 answers
  • I honestly don’t know how to do this! Please help
    6·2 answers
  • What is the solution of the equation?
    5·2 answers
  • What value of x makes this equation true? HELP ASAP PLZ PLZ PLZ PLZ
    14·2 answers
  • PLEASE HELP:(
    12·1 answer
  • Please help!! Find the value of x.<br> 6<br> 8<br> A<br> D<br> 4<br> x = [?]<br> Enter
    7·2 answers
  • Can someone helpp pls
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!