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

The greatest common factor of any two even numbers is always even. True or false and why?
why did some southern states begin to talk of succession?
Find the coordinates of the midpoint of the segment with the given endpoints. A(6,-3) and B(10,5)
what is 09.234 in word form
At tire depot a pair of tires sells for $216.The manager special advertises the same tires selling at a rate of $380 for 4 tires .Hoe much do you save per tire
An adult with a BMI of 25 to 30 is considered, A. Healthy B. Underweight C. Obese D. Overweight
Two examples (sentences) for monophobia
An adult with a BMI of 25 to 30 is considered, A. Healthy B. Underweight C. Obese D. Overweight
949 rounded to the nearest ten
Throughout history, a basic purpose of government has been to provide (1) equal rights for all people (2) laws to maintain order (3) representation for all soci