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
Nonamiya [84]
3 years ago
10

Give a big-O estimate for the number of operations, where an operation is a comparison or a multiplication, used in this segment

of an algorithm (ignoring comparisons used to test the conditions in the for loops, where a1, a2, ..., an are positive real numbers). m :
Mathematics
1 answer:
kap26 [50]3 years ago
8 0

Answer:

O(n2)

Step-by-step explanation:

the first iteration algorithm of the i-for loop (the outer loop), the j-for loop (the inner loop) will run 2 to

n times which is represented as

(n − 1 times).

the second iteration algorithm of the i-for loop, the j-for loop will run 3 to n times represented as

(n − 2 times).

the third to the last iteration algorithm of the i-for loop, the j-for loop will run n − 1 to n times (2 times).

And the second to the last iteration of the i-for loop, the j-for loop will run from n to n times (1 time)

For the last iteration of the i-for loop, the j-for loop will run 0 times because i + 1 > n.

Now we know that the number of times the loops are run is

1 + 2 + 3 + . . . + (n − 2) + (n − 1) = n(n − 1)/2

So we can express the number of total iterations as n(n − 1)/2.

Since we have two operations per loop (one comparison and one multiplication), we have

2 ·n(n−1)/2 = n

2 − n operations.

So f(n) = n2 − n

f(n) ≤ n2

for n > 1.

Therefore, the algorithm is O(n2) with

C = 1 and k = 1.

You might be interested in
The cost of 2 kg of onions is ₹24. What will the cost of 12 kg of onions be?​
max2010maxim [7]

Answer:

144 rupees

Step-by-step explanation:

2 kg= 24 rupees

2/2 kg= 24/2 rupees

1 kg= 12 rupees

1×12 kg= 12×12 rupees

12 kg= 144 rupees

8 0
3 years ago
13 = -7 + 9x - 5x<br> X =
brilliants [131]

Answer:

x = 5

Step-by-step explanation:

Given

13 = - 7 + 9x - 5x , that is

13 = - 7 + 4x ( add 7 to both sides )

20 = 4x ( divide both sides by 4 )

5 = x

3 0
3 years ago
Could mud wrestling be the cause of a rash contracted by Washington State University students in the spring of 1992? Physicians
Daniel [21]
Thank you for posting your question here at brainly. Feel free to ask more questions.   
<span>
The best and most correct answer among the choices provided by the question is </span><span>A. Between 0.05 and 0.01 </span> .    
      <span>
Hope my answer would be a great help for you.  </span>
7 0
3 years ago
Read 2 more answers
7. The volume, V, of any cube with a side length, s, can be determined using the formula V = S^3 (s x s x s). What is the volume
sdas [7]

Answer:

count the blocks or use brain

7 0
3 years ago
Read 2 more answers
What are equivalent fractions for 8/11 and 1/10 using the least common denominator?
mote1985 [20]

Answer:

2/10 because if the two fraction

4 0
3 years ago
Other questions:
  • Solve for x. 5/3 times x ≤ 10
    13·2 answers
  • If p and q are nonzero integers, which pair of points must lie in the same quadrant?
    13·2 answers
  • Which is greater 3/4 or 10/12
    5·2 answers
  • 14. a house-painting company charges 376$ plus 12$ an hour. Another painting company charges 280$ plus 15$ an hour.
    12·1 answer
  • Find the greatest possible error for the measurement 4.7 cm. 0.05 cm 0.5 cm 1.0 cm
    5·1 answer
  • If a number is odd, then it has a remainder of 1 when divided by 2.
    6·1 answer
  • A hiking trail is 150 miles long directional signs are posted along the trail every 1/3 mile how many signs are posted along the
    11·2 answers
  • Timothy read 3,876 pages this school year. Amelia read 3,768 pages. Who read more pages this school year? E​
    14·1 answer
  • The width of a rectangle is 2 and the length is 2.what is the area of the rectangle
    8·2 answers
  • Which of the segments below is a secant?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!