dhgdzfbzdf5501 dhgdzfbzdf5501
  • 16-11-2020
  • Computers and Technology
contestada

What is the Big-Oh of the following computation? int sum = 0; for (int counter = 1; counter < n; counter++) sum = sum + counter;

Respuesta :

IfeanyiEze8899 IfeanyiEze8899
  • 16-11-2020

Answer:

The Big-O notation of the algorithm is O(n)

Explanation:

The declaration and update of the integer variable sum is a constant of O(1). The for loop statement, however, would repeat relative to the size of "n", increasing the counter variable and updating the sum total by the counter.

Answer Link

Otras preguntas

Factorize: 1+4a+4a^2​
Find the slope of the line that passes through the pair of points listed below. (8,-4), (-6, -3)
Question 1 of 10 Find the quotient and enter your answer in the space provided. 6.264 0.18 = ?
PLEASE HELP ME I AM REALLY BAD AT WORD PROBLEMS! A website offers free shipping to customers who order at least $75 dollars worth of merchandise. Della is orde
Factorize: 3x²+54x + 243​
You have a standard deck of cards. The deck has 525252 total cards and contains 444 suits: hearts, clubs, diamonds, and spades. Each suit consists of cards numb
If you're the President what will you do to remove or lessen the viros called coavid
Organisms with the most beneficial traits will survive. This is commonly known as:.
Gus receives a paycheck at the end of every week. Which reinforcement schedule is this?.
Ayer / yo / no poder / ir / partido