logo

Crowdly

Considérons l’algorithme de recherche dichotomique (binaire) dans un tableau tri...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Considérons l’algorithme de recherche dichotomique (binaire) dans un tableau trié :

 

def binary_search_recursive(arr, x, low=0, high=None):

if high is None

:

high = len(arr) -

1

if

low > high:

return -1

mid = (low + high) //

2

if

arr[mid] == x:

return

mid

elif

arr[mid] < x:

return binary_search_recursive(arr, x, mid + 1

, high)

else

:

return binary_search_recursive(arr, x, low, mid - 1)

Quelle est sa complexité temporelle dans le **pire cas** ?
More questions like this

Want instant access to all verified answers on moodle.esme.fr?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!