• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 1 out of 2 pages
Summary

Résumé Fiche BAC NSI — Algorithmes de tri : tout savoir pour décrocher les points

Document preview thumbnail
Preview 1 out of 2 pages

Fiche complète et claire sur les algorithmes de tri en Terminale NSI. Tri insertion, sélection, fusion et rapide : complexités, codes Python prêts à l'emploi, tableau comparatif et pièges du bac. Idéal pour réviser efficacement en quelques minutes.

Content preview

Fiche de révision — Algorithmes de tri | Terminale NSI

1. Tri par insertion

Principe : On parcourt le tableau de gauche à droite. Pour chaque élément, on l’insère à la bonne place dans la partie déjà
triée.

Complexité : - Meilleur cas (tableau déjà trié) : O(n) - Pire cas (tableau trié à l’envers) : O(n²) - Cas moyen : O(n²)

En place : Oui | Stable : Oui

Code Python :


def tri_insertion(tab):
for i in range(1, len(tab)):
cle = tab[i]
j = i - 1
while j >= 0 and tab[j] > cle:
tab[j + 1] = tab[j]
j -= 1
tab[j + 1] = cle
return tab



Invariant de boucle : À chaque itération i, le sous-tableau tab[0..i] est trié.




2. Tri par sélection

Principe : On cherche le minimum du tableau non trié et on le place en tête.

Complexité : - Tous les cas : O(n²)

En place : Oui | Stable : Non

Code Python :


def tri_selection(tab):
for i in range(len(tab)):
i_min = i
for j in range(i + 1, len(tab)):
if tab[j] < tab[i_min]:
i_min = j
tab[i], tab[i_min] = tab[i_min], tab[i]
return tab



Invariant de boucle : À chaque itération i, tab[0..i-1] contient les i plus petits éléments, triés.




3. Tri fusion (Merge Sort)

Principe : Diviser le tableau en deux moitiés, trier récursivement chaque moitié, puis fusionner.

Complexité : - Tous les cas : O(n log n)

En place : Non (nécessite de la mémoire supplémentaire) | Stable : Oui

Code Python :

Document information

Study
Lycée
School year
1
Uploaded on
April 24, 2026
Number of pages
2
Written in
2025/2026
Type
Summary
$5.18

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
18
Last sold
-



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions