Ответ:
Объяснение:
def Binar(arr,item):
low = 0
high = len(arr) - 1
while low <= high:
mid = (low + high) // 2
it = arr[mid]
if it == item:
return mid
if item < mid:
high = mid - 1
else:
low = mid + 1
return None
arr = [МАССИВ ИЗ ЧИСЕЛ]
number = int(input())
print(Binar(arr,number))
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
Объяснение:
def Binar(arr,item):
low = 0
high = len(arr) - 1
while low <= high:
mid = (low + high) // 2
it = arr[mid]
if it == item:
return mid
if item < mid:
high = mid - 1
else:
low = mid + 1
return None
arr = [МАССИВ ИЗ ЧИСЕЛ]
number = int(input())
print(Binar(arr,number))