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

Which Section do you code from the front?
HELP ASAP PLS, 46 P!!!! Which similarity statements would be true for the figure? (Select all that apply) A. ∆ DAB ~∆ DAC B. ∆ ABD~∆ CBA C. ∆ DAB~∆ DCA D. ∆ BCA
Marking as brainiest! Answer the two questions
Speech writingon speech and prize giving day​
What is the status of Yaminawa language?
determina cuales de los siguientes conjuntos son funciones y cuales son relaciones​
Coca-Cola markets PowerAde as a sports drink that competes with Gatorade. Competition for sports drinks is fierce where they are sold in the coolers of convenie
esaay E-learing vs class learing
A student conducts an experiment to check how high a basketball can bounce when different volumes of air are filled inside. Which of these steps will most likel
4. Consider the following amount of energy used for three different activities: . 1 minute of walking uses 25 kilojoules of energy A (4 • 1 minute of jogging us