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

Simplify 4^3/4^8 so that it is not in fraction form.
One third of a number less than nine equal to seven
Lysosomes are responsible for digestion and waste disposal in: Tree cells Flower petals Animal cells Plant and animal cells
1 pts Why do good speakers use some of the specialized vocabulary related to a topic? Group of answer choices Listeners will believe that the speaker knows a lo
if 9^x=25, what does 3^x equal?
\frac{7}{4x}+\frac{5}{4x^2} 4x 7 ​ + 4x 2 5 ​
Which warrior laid seige to U.S. forts along the Bozeman trail? Select the best answer choice. OA Red Cloud OB. White Bear OC Sitting Bull O D. Crazy Horse
8. Which of the following represents a chemical change? A. Decaying food B. Cutting bread C. Shaping cookie dough D. Mixing oil and water
The myth about the meeting of the animals helped native americans explain the existence of the four seasons. A. True B. False
You work part-time at a computer repair store, and you are on-site at a customer's premises. Your customer has signed up for DSL internet access. The phone comp