Which of the following is a valid implementation of binary search in Python?
-
def binary_search(arr, target): ...
-
def binary_search(arr, target): for i in arr: if i == target: return i
-
def binary_search(arr, target): while arr: ...
-
def binary_search(arr, target): return arr.index(target)