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

Aiko spends 2.5 hours baking croissants for a community center bake sale. She bakes the 90 croissants in 5 batches. Determine the number of batches Aiko baked p
The 1957 presidential policy that extended U.S. economic and military aid to any country in the Middle East seeking assistance against the threat of communism
Mayans created calendars and built pyramids. true or false
Mary can either take her lunch or buy it at school. It cost 1.95 to buy lunch. If she wants to spend no more than $30 on lunch per month, how many lunches can s
Please answer number 12. Very urgent!! 18 points!
Select the items that explain why Grant thought he would eventually defeat Lee. superior resources better communications receive reinforcements for his army
find the value of m. 4(m-2)=24
The quotient of negative seven and the sum of a number and negative six
You have $50 in your bank account. You make $8 per hour mowing lawns. How many hours must you mow lawns to have a total of $130 $ in your account?
Please help quickly!!! 20 points!! Look at the clock and the data table below. Based on the data and on your knowledge of potential and kinetic energy, what is