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

Eric ran 4 laps around the school track. He ran a total distance of 1 mile. Which shows the distance Eric ran in moles?
What ratio is equivalent to 12:13
(1)Arrange the list of numbers in increasing order. 2/5 , 4/9 , 3/7 (2)Which number is halfway between 1/2 and 5/6? A.7/10 B.13/20 C.27/40 D.2/3
Which term defines a work of art created by painting on damp plaster? a. jihad b. fresco c. icon d. rococo
Use the GCF to factor this expression: 90x + 4
Fred brought 4 liters of liquid laundry detergent, 3,250 milliliters of fabric softener, and 2.5 liters of bleach. For 4a-4e, select True or False for each stat
African elephants flap their large ears to cool off. Which biology theme does this phenomenon represent?
Blood, muscle, and bone cells are examples of _____. specialized cells. tissues. organs. plant cells.
Why did the globe theatre close for a few years
What is another name for any living thing?