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

According to Freytag what stage of a plot immediately follows the climax? A. Denouement B. Falling action C. Exposition D. Inciting incident
What rights did women in the West earn before women in the East? the right to bear arms and to own property the right to vote and own property the right to Tri
What are the products in the following chemical reaction? Pb(NO3)2 + KCl A PbCl + KNO3 B PbCl2 + KNO3 C Pb2Cl + K2NO3 D PbCl + K(NO3)2
Acculturation occurs when
Two 6-sided dice are rolled at the same time. How many outcomes correspond to the event that the sum of the numbers is 5?
find the difference : 7 7/8 - 3 1/4 =
Will drawing an angle bisector always result in two acute angles?
what is 8.21 as a mixed number
How does potassium ions behave when current is passed through the electoryte
Multiple similarity transformations are performed on a triangle. which elements must be preserved?