Skip to content

Commit Mathieu Chicoine TP tris#38

Open
Matchico86 wants to merge 3 commits intobcalou:mainfrom
Matchico86:main
Open

Commit Mathieu Chicoine TP tris#38
Matchico86 wants to merge 3 commits intobcalou:mainfrom
Matchico86:main

Conversation

@Matchico86
Copy link
Copy Markdown

No description provided.

@Matchico86
Copy link
Copy Markdown
Author

j'espère que la PR est entière, je ne suis pas sûr d'avoir compris ce que j'ai fait '^^

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 +4 to +7
if number <= 1:
return number
else:
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

value = array[index]
j = index - 1
while j >= 0 and array[j] > value:
array[j + 1], array[j] = array[j], value
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.

Cette opération va être éxécutée plusieurs fois, alors qu'il suffit de trouver le bon emplacement et de faire un déplacement unique

sort/fusion.py Outdated
print(array)
array1: list[int] = array[0 : len(array) // 2]
sort(array1)
array2: list[int] = array[len(array) // 2: len(array)]
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.

Pas besoin de spécifier la limite de fin quand on prend tout le reste de tableau (ni le 0 quand on part du début)

@bcalou
Copy link
Copy Markdown
Owner

bcalou commented Dec 5, 2023

Réponses incomplètes sur la justification des complexité (et fausse pour la fusion : ce n'est pas O(N²) mais O(n log n))
Il y a un fichier chart mais on ne sait pas ce qu'il représente.
Optimisation possible dans insertion : il ne faut pas déplacer les éléments un par un (dans le while) mais juste insérer l'élément au bon endroit en une fois (après le while)
Des petits détails donc, mais un bon travail dans l'ensemble.

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.

2 participants