Merge branch 'master' of githubu:GeoffreyFrogeye/tp-info
This commit is contained in:
commit
d7ada41d2f
|
@ -26,7 +26,22 @@ def squestion(lettre):
|
|||
question(1) # Programmer recherches seq, seq triée, dicho
|
||||
|
||||
def seq(l, a, b, x): # Jean-loup
|
||||
return None
|
||||
"""
|
||||
Recherche séquentielle de l'élément x dans la liste l, entre les borne a et b, b étant exclu
|
||||
list(x), int, int, x → (bool, int)
|
||||
CU: 0 <= a < b <= len(l)
|
||||
"""
|
||||
|
||||
assert(a >=0 and b > a and b <= len(l))
|
||||
|
||||
i=a
|
||||
|
||||
while i < b and l[i] != x:
|
||||
i += 1
|
||||
if i < b:
|
||||
return (True, i)
|
||||
else:
|
||||
return (False, 0)
|
||||
|
||||
def seqTrie(l, a, b, x): # Jean-loup
|
||||
return None
|
||||
|
|
Reference in a new issue