Update binary_search.py

This commit is contained in:
bt3gl 2023-07-30 15:58:03 -07:00 committed by GitHub
parent e4bfc72334
commit cd0575f81e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# author: bt3gl # author: bt3gl
def binary_search_recursive(array, item, higher=None, lower=0): def binary_search_recursive(array, item, higher=None, lower=0):
higher = higher or len(array) higher = higher or len(array)
@ -30,6 +31,7 @@ def binary_search_iterative(array, item):
lower=mid+1 lower=mid+1
return False return False
def binary_search_matrix(matrix, item, lower=0, higher=None): def binary_search_matrix(matrix, item, lower=0, higher=None):
""" Binary search in a matrix """ """ Binary search in a matrix """