suppression ancien fichier cours Pile & File, et ajout des sujets bacs NSI
This commit is contained in:
18
Sujet_bac/Pratique/BNS_2025/25-NSI-18/sujet-18.py
Normal file
18
Sujet_bac/Pratique/BNS_2025/25-NSI-18/sujet-18.py
Normal file
@@ -0,0 +1,18 @@
|
||||
def dichotomie(tab, x):
|
||||
"""applique une recherche dichotomique pour déterminer
|
||||
si x est dans le tableau trié tab.
|
||||
La fonction renvoie True si tab contient x et False sinon"""
|
||||
|
||||
debut = 0
|
||||
fin = ...
|
||||
while debut <= fin:
|
||||
m = ...
|
||||
if x == tab[m]:
|
||||
return ...
|
||||
if x > tab[m]:
|
||||
debut = ...
|
||||
else:
|
||||
fin = ...
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user