Tous les livres

Professionnel

Applis À propos Coach Connexion Commencer la lecture

Computer Science · Glossaire

Qu'est-ce que « Merge, merge sort » ?

Aussi appelé : merge (of sorted lists) · merge sort · merge (of sorted sequences)

Definition 27.3 High School Computer Science · Chapitre 27 — Divide and Conquer

To merge two sorted lists is to make one sorted list of all their elements, by repeatedly moving the smaller of their two first elements to the output. Merge sort sorts a list by splitting it into two halves, sorting each by merge sort, and merging the results; a list of 00 or 11 element is already sorted.

One step of merge. The grey elements are already in out, which is sorted and holds the smallest of a and of b. Only a[i] and b[j] are compared: the smaller is the next element.
One step of merge. The grey elements are already in out, which is sorted and holds the smallest of a and of b. Only a[i] and b[j] are compared: the smaller is the next element.
Merge sort on eight numbers: three levels of splitting, then three levels of merging (shaded). Each level of merging handles all eight numbers once.
Merge sort on eight numbers: three levels of splitting, then three levels of merging (shaded). Each level of merging handles all eight numbers once.
Lire dans le chapitre →
Definition 19.7 University Computer Science — Year 1 · Chapitre 19 — Sorting

To merge two sorted sequences is to build the sorted sequence of their elements by repeatedly taking the smaller of their two first elements. Merge sort sorts the two halves of an array recursively and merges them.

Lire dans le chapitre →