# Τ.Ε.Μ. κεφ 5 Δρ7τ Δυαδική αναζήτηση σε αύξουσα ...

Να επιλεξετε τον  σωστό αλγόριθμο της Δυαδικής αναζήτησης ενός στοιχείου key σε μια αύξουσα ταξινομημένη λίστα array

def binarySearch(array, key):

first = 0

last = len(array) - 1

found = False

mid = (first + last) / 2

if array[mid] == key:

found = True

elif array[mid] < key:

first = mid - 1

else:

last = mid + 1

return found

def binarySearch(array, key):

first = 0

last = len(array) - 1

found = False

mid = (first + last) / 2

if array[mid] == key:

found = True

elif array[mid] < key:

first = mid + 1

else:

last = mid - 1

return found

def binarySearch(array, key):

first = 0

last = len(array) - 1

found = False

mid = (first + last) / 2

if array[mid] == key:

found = True

elif array[mid] > key:

first = mid + 1

else:

last = mid - 1

return found

def binarySearch(array, key):

first = 0

last = len(array) - 1

found = False

mid = (first + last) / 2

if array[mid] == key:

found = True

elif array[mid] < key:

last = mid + 1

else:

first = mid - 1

return found