Data Structures
Binary Search (Recursive)
Recursive binary search on a sorted array in O(log n) time with O(log n) call-stack space, in Python, Java and C++.
150 notes tagged
Recursive binary search on a sorted array in O(log n) time with O(log n) call-stack space, in Python, Java and C++.
Classic iterative binary search on a sorted array in O(log n) time, with Python, Java and C++ code and an overflow-safe midpoint.