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

How do you Solve d-5 >-3
Peggy was taking a timed 70-question test. She was able to correctly answer 70% of the questions but had to skip the rest. How many questions did Peggy answer
Which of the following conditions will maximize the amount of interest you earn
Salzman seems to suddenly appear and disappear, wears clothes that look like costumes, and gestures in an animated way with long, bony fingers. These characteri
Why did Ji-li’s father prevent her from auditioning for the dance troupe? He knew the family could not pass a background investigation. He hoped to move the fam
Add and simplify 9 / 16 + 1 /2 =
Please help me, a of these questions
kai has 32 tickets. he wants to put the same number of tickets into 4 boxes.
Why do some observers refer to the present day as the graying of america?
A line passes through points (3,16) and (9,22). Write a linear function rule in terms of x and y for this line.