shekinahconnoll5055 shekinahconnoll5055
  • 23-03-2020
  • Computers and Technology
contestada

The code segment below prints some of the elements in an array with size n. Select an expression to

complete the code segment so that the resulting algorithm has O(log n) running time.

for __________________________

System.out.println(array[j]);

Respuesta :

abdullahfarooqi
abdullahfarooqi abdullahfarooqi
  • 27-03-2020

Answer:

int j = 1; j < array.length; j =j *2

Explanation:

j=j*2 loops have O(logn) so the running time of algorithm is O(logn).

Answer Link

Otras preguntas

Five friends compete in a dart-throwing contest. Each one has two darts to throw at the same circular target, and each individual's score is the sum of the scor
I really need help with this
Bella leaves her office building only to find it is raining. She returns to her office and gets a trash bag out of the supply cabinet. Using a pair of scissors,
Mars Inc. produces 100,000 boxes of Snickers bars which sell for $4 a box. If variable costs are $3 per box, and it has $150,000 fixed operating costs, in the s
list the temples built by Rastrakuta rulers ?​
Some people have sustained brain damage and lost the ability to identify color. Other people sustained different brain damage and lost the ability to detect mot
Do you know what this is on English?
1) A) Use multiple elaborated historical examples from each decade to explain How fighting for labor rights, gender rights, and civil rights are connected.
During the Cold War, the United States supported anti-communist dictators who committed human rights abuses and opposed democratic freedoms. What does this indi
Gato Inc. had the following inventory situations to consider at January 31, its year-end. Identify which of the following items should be included in inventory.