// binary search on sorted array of size nWhat is the worst-case time complexity?
- A
O(n log n)
- Bcheck_circle
O(log n)
- C
O(1)
- D
O(n)
Explanation
Binary search halves the search space each step, giving O(log n).
AP Computer Science A· difficulty 2/5
// binary search on sorted array of size nWhat is the worst-case time complexity?
O(n log n)
O(log n)
O(1)
O(n)
Explanation
Binary search halves the search space each step, giving O(log n).
Want 10 more like this — adaptive to your weak spots?
Binary search requires the array to be…
chevron_rightWhich statement about Java's typical binary-search algorithm is TRUE?…
chevron_rightPerforming iterative binary search for the value 17 in the sorted array shown, how many <codemid</code values are computed (i.e., how many loop iterations occur…
chevron_right