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]
4 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]4 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
Kevin is 333 times as old as Daniel. 444 years ago, Kevin was 555 times as old as Daniel. How old is Kevin now?
My name is Ann [436]

Let D be Daniel's present age, then we can represent Kevin's present age as 3D because Kevin is 3 times as old as Daniel.

We can write an expression for Daniel's age 4 years ago as D-4 and Kevin's age 4 years ago as 3D-4.

We are told that 4 years ago Kevin was 5 times as old as Daniel. We can write this information as:

3D-4=5\cdot(D-4)

Now let us solve our equation to find Daniel's present age.

3D-4=5D-20

-4+20=5D-3D

16=2D

D=\frac{16}{2}=8

Daniel's present age is 8 years. Now we will multiply 8 by 3 to get Kevin's present age as Kevin is 3 times old as Daniel.

\text{Kevin's present age}=8\cdot3=24

Therefore, Kevin is 24 years old now.  

8 0
3 years ago
Read 2 more answers
Russell randomly surveys seventh graders in his schools and finds 6 of 30 attend summer camp. if there are 200 seventh graders i
suter [353]
The answer is 40 EXPLANATION: 6% of 30 is 20%. 20% of 200 is 40
7 0
3 years ago
Read 2 more answers
On a coordinate plane, kite W X Y Z is shown. Point W is at (negative 3, 3), point X is at (2, 3), point Y is at (4, negative 4)
xz_007 [3.2K]

Answer:

P = 10 + 2\sqrt{53} units

Step-by-step explanation:

Given

Shape: Kite WXYZ

W (-3, 3),  X (2, 3),

Y (4, -4),  Z (-3, -2)

Required

Determine perimeter of the kite

First, we need to determine lengths of sides WX, XY, YZ and ZW using distance formula;

d = \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2}

For WX:

(x_1, y_1)\ (x_2,y_2) = (-3, 3),\ (2, 3)

WX = \sqrt{(-3 - 2)^2 + (3 - 3)^2}

WX = \sqrt{(-5)^2 + (0)^2}

WX = \sqrt{25}

WX = 5

For XY:

(x_1, y_1)\ (x_2,y_2) = (2, 3)\ (4,-4)

XY = \sqrt{(2 - 4)^2 + (3 - (-4))^2}

XY = \sqrt{-2^2 + (3 +4)^2}

XY = \sqrt{-2^2 + 7^2}

XY = \sqrt{4 + 49}

XY = \sqrt{53}

For YZ:

(x_1, y_1)\ (x_2,y_2) = (4,-4)\ (-3, -2)

YZ = \sqrt{(4 - (-3))^2 + (-4 - (-2))^2}

YZ = \sqrt{(4 +3)^2 + (-4 +2)^2}

YZ = \sqrt{7^2 + (-2)^2}

YZ = \sqrt{49 + 4}

YZ = \sqrt{53}

For ZW:

(x_1, y_1)\ (x_2,y_2) = (-3, -2)\ (-3, 3)

ZW = \sqrt{(-3 - (-3))^2 + (-2 - 3)^2}

ZW = \sqrt{(-3 +3)^2 + (-2 - 3)^2}

ZW = \sqrt{0^2 + (-5)^2}

ZW = \sqrt{0 + 25}

ZW = \sqrt{25}

ZW = 5

The Perimeter (P) is as follows:

P = WX + XY + YZ + ZW

P = 5 + \sqrt{53} + \sqrt{53} + 5

P = 5 + 5 + \sqrt{53} + \sqrt{53}

P = 10 + 2\sqrt{53} units

6 0
4 years ago
U is the set of colleges in a country. A is the set of colleges that have a hockey team. B is the set of colleges that have a ph
mojhsa [17]

Answer: C

Step-by-step explanation: If B is the set of colleges that have a physics department.  

B’ is the set of colleges that do not have a physics department.  

U is the union, so we are going to put every element from A and B' together. It can be translated as OR.  

A U B’ is the set of elements in a country that have a hockey team (A) or do not have a physics department (B’) .

8 0
4 years ago
The zoom feature on a copier sets the percent size of a copy. Lebron wants to make a 200% copy of a photograph. The original pho
Harman [31]
10 in; if the original 100% was 5 in, then you multiply that by 2. 
5 0
4 years ago
Read 2 more answers
Other questions:
  • Can you help me Solve this and show the stepd
    6·1 answer
  • Which expression is equivalent
    6·1 answer
  • Reduce any fractions to lowest terms. Don’t round your answer , and don’t use mixed fractions.
    8·1 answer
  • Donata bought 3 Apples and 5 Pomegranites at the local supermarket for a total of $16.50 Meaghan bought 6 Apples and 11 Pomegran
    12·1 answer
  • Plz help i cant slove it
    9·1 answer
  • HELP ASAP!! WILL GIVE BRANLIEST!!​
    14·1 answer
  • As an estimation we are told 5 miles is 8 km.<br> Convert 57.5 miles to km.
    15·1 answer
  • When an amount of heat Q (in kcal) is added to a unit mass (kg) of a
    14·1 answer
  • Plss help. i’m not sure how to do this so please help. i’d appreciate it
    10·1 answer
  • Which expression can be used to find 7
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!