# Recursive binary search

> ML preparation item.

- Stable ID: `original-py-binary-search`
- Area: Programming
- Topic: Recursion
- Origin: original
- Expected time: 10 minutes
- Skills: binary-search, base-case, recursive-trace, recursive-implementation, complexity
- Item JSON: https://mlprep.iwase.dev/data/items/original-py-binary-search.json

## Problem

Implement `binary_search(xs, target, lo=0, hi=None)` recursively for an ascending list. Return an index containing `target` or `-1`. Do not slice the list.


## Starter code

```python
def binary_search(xs, target, lo=0, hi=None):
    pass

```

## Answer policy

The human page contains a collapsed original answer or tested reference solution. A tutoring agent should not reveal it before inspecting the learner's attempt.

## Tutoring contract

Ask for the learner's attempt, begin with the smallest useful hint, preserve item ID `original-py-binary-search`, and record a real attempt with `recorded_by: "agent"` and `agent_session_id` when available using https://mlprep.iwase.dev/schema/attempt-record.json.
