Skip to content

Rendu Timothée#32

Open
TimoMet wants to merge 5 commits intobcalou:mainfrom
TimoMet:main
Open

Rendu Timothée#32
TimoMet wants to merge 5 commits intobcalou:mainfrom
TimoMet:main

Conversation

@TimoMet
Copy link
Copy Markdown

@TimoMet TimoMet commented Nov 24, 2023

No description provided.

@TimoMet TimoMet marked this pull request as ready for review November 24, 2023 10:15
@NanaNana64
Copy link
Copy Markdown

Pas mal

@TimoMet TimoMet marked this pull request as draft November 24, 2023 12:21
@TimoMet TimoMet marked this pull request as ready for review November 24, 2023 13:27
Copy link
Copy Markdown
Owner

@bcalou bcalou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bien

Comment on lines +8 to +16
for i in range(len(array)):
min_index: int = i
# Find the index of the smallest element
# in the unsorted part of the array
for j in range(i + 1, len(array)):
if array[j] < array[min_index]:
min_index = j
# Swap the smallest element with the first element of the unsorted part
array[i], array[min_index] = array[min_index], array[i]
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bien, juste ajouter quelques lignes vides (par exemple avant les commentaires)

Comment on lines +8 to +10
if number == 0:
return 1
return number * get_factorial(number - 1)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ternaire possible

Comment on lines +11 to +13
while j >= 0 and key < array[j]:
array[j + 1] = array[j]
j -= 1
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tu modifies le tableau à chaque itération. On peut le modifier une seule fois, après avoir trouvé le bon index.

:return: The sorted array.
"""
for i in range(1, len(array)):
key: int = array[i]
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pourquoi key ?

sort/fusion.py Outdated
@@ -1,2 +1,43 @@
def merge(left: list[int], right: list[int]) -> list[int]:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conserver l'ordre d'appel des fonctions (sort au début du fichier)

@bcalou
Copy link
Copy Markdown
Owner

bcalou commented Dec 5, 2023

Très bien, très clair. Il y a juste le code de l'insertion qui est dépourvu de commentaires, donc pas simple à suivre.
Réponses claires au TP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants