SSVISUAL.COM
function binary_search(list, target): left = 0 right = length(list) - 1 WHILE left <= right: mid = (left + right) // 2 IF list[mid] == target: RETURN mid ELIF list[mid] < target: left = mid + 1 ELSE: right = mid - 1 END IF END WHILE
Left Index:
Right Index:
Middle Index: