Code Tracer
Trace code execution step-by-step or run the real program.
Binary Search
Input
[1, 3, 5, 7, 9, 12, 15]
Python
1def binary_search(arr, target):2low = 03high = len(arr) - 145while low <= high:6mid = (low + high) // 278if arr[mid] == target:9return mid10elif arr[mid] < target:11low = mid + 112else:13high = mid - 11415return -1
Current Line
Line —
Variables
Run the tracer to see variables.
Call Stack
binary_search(arr, target)
Output
No output yet