Multiple Choice
The code segment below displays a pattern of asterisks. Select an expression to complete the code segment so that the resulting algorithm has O(n) running time. for (int k = 0; k < n; k++)
{
For _______________________
{
System.out.print("*") ;
}
System.out.println() ;
}
A) (int j = n; j > 0; j = j / 2)
B) (int j = n; j > 0; j--)
C) (int j = 1; j < k; j++)
D) (int j = 1; j <= 10; j++)
Correct Answer:

Verified
Correct Answer:
Verified
Q82: Assume we are using quicksort to sort
Q83: A portion of your program implements a
Q84: Which function has a faster growth rate:
Q85: Merge sort has a O(n log<sub>2</sub>(n)) complexity.
Q87: Consider the following code snippet: public static
Q88: If the Arrays static method binarySearch is
Q89: The sort method of the Arrays class
Q90: In the worst case, a linear search
Q91: After 9 iterations of selection sort working
Q96: Which sort algorithm is used in the