Searching Algorithms: Binary Search - Implementations in C++ - Higher Difficulty Problems

Download Q&A
Q. In a binary search algorithm, what happens if the middle element is less than the target?
  • A. Search the left half
  • B. Search the right half
  • C. Return the middle element
  • D. Terminate the search
Q. In a binary search implementation, what condition is checked to determine if the search should continue?
  • A. If the target is less than the middle element
  • B. If the target is greater than the middle element
  • C. If the target is equal to the middle element
  • D. All of the above
Q. What is the space complexity of the iterative version of binary search?
  • A. O(n)
  • B. O(log n)
  • C. O(1)
  • D. O(n log n)
Q. Which of the following is a requirement for using binary search?
  • A. The array must be sorted
  • B. The array must be unsorted
  • C. The array must contain unique elements
  • D. The array must be of fixed size
Showing 1 to 4 of 4 (1 Pages)
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely