Ask your AI Ask your AI to turn this code into a guided bug-finding exercise.
Claude ChatGPT I am reading "Which condition must hold before binary search can safely discard half of the remaining range?" on CodeWiki (https://codewiki.com/practice/mcq/foundations/checkpoint-1/checkpoint-1-binary-search/).
Context (verbatim from the page):
"""
Which condition must hold before binary search can safely discard half of the remaining range?
The data is ordered under the same comparator used by the search.
The collection contains no duplicate values.
The target is known to be present.
"""
Introduce three subtle bugs into the example above and let me find them. Reveal each answer only after I have guessed.
Answer in English. Keep code examples in CS foundations. Where you are unsure, say so.