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

what is the mechanical layer of earth that contains the tectonic plates
When an individual moves into one population from a different population,it is called
During which phase of mitosis do the sister chromatids lineup in the middle of the cell?
Can someone help me with two please?
Historically, many religions tended to be patriarchal in nature. often, women were not allowed to participate in religious services or they were separated from
can you add 3g+3g+10? (math)
is 0.844% greater than or less than 93%
how the plants in and around ameadow provide habbitat for a butterfly,field mouse and owl
What is the main fuel of a main sequence Star
Jacob needs less than 5 C's on his transcript to qualify for UGA. He already has 1 C. At most, how many more C's can he get and still be able to go to UGA? Wri