Conversation
bcalou
left a comment
There was a problem hiding this comment.
Extrême similarité avec le code de Timothée, même dans les imperfections. S'entraider est différent de copier/coller, et on s'en rend compte très vite en corrigeant.
Moi et timothée n'avons pas travaillé sur ce TD ensemble ni même ne nous sommes entraidés, les similarités sont donc fortuites. |
sort/insertion.py
Outdated
| :return: sorted array | ||
| """ | ||
| for i in range(1, len(array)): | ||
| key = array[i] |
sort/insertion.py
Outdated
| while j >= 0 and key < array[j]: | ||
| array[j + 1] = array[j] | ||
| j -= 1 |
There was a problem hiding this comment.
Tu modifies le tableau à chaque itération. On peut le modifier une seule fois, après avoir trouvé le bon index.
sort/recursion.py
Outdated
| if number == 0: | ||
| return 1 | ||
| else: | ||
| return number * get_factorial(number - 1) |
sort/selection.py
Outdated
| for i in range(len(array)): | ||
| min_index = i | ||
| for j in range(i + 1, len(array)): | ||
| if array[min_index] > array[j]: | ||
| min_index = j | ||
|
|
||
| array[i], array[min_index] = array[min_index], array[i] |
There was a problem hiding this comment.
Quelques commentaires pour mieux suivre la logique ?
|
Réponses claires au TP. Code très clair avec beaucoup d'attention à la lisibilité. |
No description provided.