ICODERNET Telegram 879
This media is not supported in your browser
VIEW IN TELEGRAM
def binary_search(arr, x):
low = 0
high = len(arr) - 1
mid = 0
while low <= high:
mid = (high + low) // 2
if arr[mid] < x:
low = mid + 1
elif arr[mid] > x:
high = mid - 1
else:
return mid
return -1

arr = [ 1,2,3,4,5,6,7 ]
x = 7
result = binary_search(arr, x)
if result != -1:
print("Element is present at index", str(result))
else:
print("Element is not present in array")
👍1



tgoop.com/iCoderNet/879
Create:
Last Update:

def binary_search(arr, x):
low = 0
high = len(arr) - 1
mid = 0
while low <= high:
mid = (high + low) // 2
if arr[mid] < x:
low = mid + 1
elif arr[mid] > x:
high = mid - 1
else:
return mid
return -1

arr = [ 1,2,3,4,5,6,7 ]
x = 7
result = binary_search(arr, x)
if result != -1:
print("Element is present at index", str(result))
else:
print("Element is not present in array")

BY #iCoderNet


Share with your friend now:
tgoop.com/iCoderNet/879

View MORE
Open in Telegram


Telegram News

Date: |

bank east asia october 20 kowloon Hui said the messages, which included urging the disruption of airport operations, were attempts to incite followers to make use of poisonous, corrosive or flammable substances to vandalize police vehicles, and also called on others to make weapons to harm police. Select “New Channel” How to create a business channel on Telegram? (Tutorial) In the next window, choose the type of your channel. If you want your channel to be public, you need to develop a link for it. In the screenshot below, it’s ”/catmarketing.” If your selected link is unavailable, you’ll need to suggest another option.
from us


Telegram #iCoderNet
FROM American