TP4 dicho inversion

This commit is contained in:
Geoffrey Frogeye 2015-02-24 11:06:43 +01:00
parent 07df5749a3
commit 7606f6e7be

View file

@ -74,7 +74,7 @@ def dicho(l, a, b, x): # Geoffrey
assert(type(a) == type(b) == int), "a et b doivent être des ints" assert(type(a) == type(b) == int), "a et b doivent être des ints"
assert(0 <= a < b <= len(l)), "Il faut que 0 ≤ a < b ≤ len(l)" assert(0 <= a < b <= len(l)), "Il faut que 0 ≤ a < b ≤ len(l)"
a = d d = a
f = b - 1 f = b - 1
while d < f: while d < f:
m = (d+f)//2 m = (d+f)//2