summaryrefslogtreecommitdiff
path: root/progs/a734.py
blob: 87acf6973ca8dca4f5e3ee63c920ee6e36d06cd4 (plain)
1
2
3
4
5
6
7
8
def smallest_missing(A, left_element, right_element):
    if left_element > right_element:
        return left_element
    mid = left_element + (right_element - left_element) // 2
    if A[mid] == mid:
        return smallest_missing(A, mid + 1, right_element)
    else:
        return smallest_missing(A, left_element, mid - 1)