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

(2) Han spent 75 minutes practicing the piano over the weekend. Priya practiced the violin for 152% as much time as Han practiced the piano. How long did she pr
theres another one of these. If someone answers could they please leave an explanation? thank you​
Earth is the largest terrestrial planet in the solar system. Earth's huge size enables it to exert enough gravitational force to hold onto its . Mars, which is
Carl needs to take 2 pair of jeans and 4 shirts to camp. How many shirts & jeans do he need for 14 days
Please help it’s easy will give brainlist !! Thank youu worth a lot be serious pls
How does the water help the fission process?
How does one build up their self-confidence, according to the Unit section?Question 2 options:compliment yourselfpraise yourself for tryingset realistic goalsal
Please help and show work: 5) Joe has a 14 ft ladder that is propped against a building. If the base of the ladder and the base of the building are √75 ft apart
I need x and y please
2. What is 14 out of 28 expressed as a fraction?​