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

Using knowledge of the Latin prefix "extra," which word best defines "extravagance" in paragraph 9?
33. ______________________, 34. ___________________________ 35. _________________________ are the Declaration of Independence founders from North Carolina.
All illnesses are considered to be diseases, but not all diseases are considered illnesses. True False
Which statement is true about the ratios of squares to circles in the tables? The ratios in Table A are greater than the ratios in Table B. The ratios in Table
why did the empire of the abbasid caiphs decline and eventually break up
a teacher divides her class into groups and assigns each group a task of measuring the mass of the same object three times.the teacher already knows that the ma
How does the NASA article differ from the Team Moon text? The NASA article is more emotional. The NASA article sounds more like a newspaper story The NASA artic
what is 99/100 written as a decimal
What was the intended purpose for new scaristy
Which is a Hardy Ramanujan Number ?