17 lines
406 B
Python
17 lines
406 B
Python
def insere(tab, a):
|
|
"""
|
|
Insère l'élément a (int) dans le tableau tab (list)
|
|
trié par ordre croissant à sa place et renvoie le
|
|
nouveau tableau.
|
|
"""
|
|
tab_a = [ a ] + tab # nouveau tableau contenant a
|
|
# suivi des éléments de tab
|
|
i = 0
|
|
while i < ... and a > ...:
|
|
tab_a[i] = ...
|
|
tab_a[i+1] = a
|
|
i = ...
|
|
return tab_a
|
|
|
|
|