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

why are 1/2 and 1/4 called equivalent fractions
El sonido que hacen las ovejas se llama ____________.
Definition of average daily balance
What were northern soldiers called in the civil war besides union?
A heated piece of metal cools according to the function c(x) = (.5)x − 7, where x is measured in hours. A device is added that aids in cooling according to the
In the following reaction, what coefficient will be written before the oxygen molecule (O2) to balance the chemical equation? _____ C5H12 + _____ O2 _____ CO2
What were the effects of the Plessy v. Ferguson decision? Check all that apply. It found the Fourteenth Amendment to be unconstitutional. It established a new
Gerald wants to buy a pair of jeans, polyester pants, or cotton pants for his upcoming camping trip. The cost is similar for each item, and he can't decide whic
Is this right or no if not what's the answer to it
what geological processes form natural gas