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

Jill has 4 bags of marbles. There are 3red, 5green,2 yellow, and 6black marbles I. Each bag. How many marbles does Jill have? Show how you found the answer
Please Help Which is a TRUE statement about cancer? A. You can reduce your risk of cancer by increasing the amount of fat you eat. B. Salt has been linked to
During diffusion molecules tend to move from (blank) to (blank). answer the blanks please
how to solve (512) in a radical expression 1/3
Question 1. How does the Constitution distribute power? It focuses most of the government's power in the president, who is checked by the other branches. It di
Is weight control the primary benefit of exercising
What root does not represent something edible
How do you write 226% as a fraction, mixed number, or whole number in simplest form?
Today, many east asian families are becoming scattered as people move to cities. also, more women now work outside the home. how might these changes affect the
Why was kristine surprised when nora offered Dr. Rank a macaroon