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

Which statement best characterizes the ideas of John Locke? People are naturally reasonable. People are naturally selfish and violent. Governments create unequa
Vegeterians are healthier than people who eat meat fact or opinion explain
Support that P(e)=0.76,P(F)=0.45,and P(E and F)=0.32. What is P (E or F)?
how many triangles form by the diagonals from a fixed vertex has 11 12 13 14 15 sided polygon
the one in red. thank you
systems of equations 2x+2y=16 2x+6y=28
how to tell if a sequence is arithmetic or geometric
based on the theory of evolution, in which rock layer would we find the least biodiversity?.
need help fast Consider the following situation: A patient with a life-threatening disease has been unconscious for several weeks. A new, experimental medicin
please help Your skin is constantly producing new cells through cell division. How does this happen? During interphase, how does a cell prepare for division? D