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

A bag contains 3 red cards numbered 1-3 and 4 white cares numbered 1-4 you choose a card at random
Which of these are you likely to find in a badland?? ASAP Heavy rainfall Hardwood trees Peat Erosion
Shana is a competitive athlete who weighs 135 lb. she would like to plan a nutritionally adequate diet that provides enough carbohydrate to maintain her weight
hey can you please help me posted picture of question
If a club charges an initial fee of $99 to join, and a monthly fee of $45. Write an equation that represents the cost of being a member of the club. How much
"the ____ criteria filter requires the records displayed to have the specified text string anywhere."
100 points!! Help please, find the volume
Two boys decided to buy a computer. The second boy had 5/6 of the money the first had. The first boy had 7/8 of the price of the computer. Together they had
vector u has a magnitude of 4 and a direction angle of 30 degrees. write the component form of this vector
How gravity affect time ? With reference to einstein special theory of relativity