SlideServe
Menu
Préférences
© SlideServe · v2026

Introduction to Sorting Algorithms: Insertion, Bubble, and Merge Sort

mhering avatar
12 diapositives · 157 Views · Jan 02, 2020

Learn about different sorting algorithms including Insertion Sort, Bubble Sort, and Merge Sort. Compare their performance with different sizes and types of data.

Introduction to Sorting Algorithms: Insertion, Bubble, and Merge Sort - slide 1
01 / 12Introduction to Sorting Algorithms: Insertion, Bubble, and Merge Sort
1 / 17

Télécharger la présentation

Introduction to Sorting Algorithms: Insertion, Bubble, and Merge Sort
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. CompSci 6Introduction to Computer Science Dec 6, 2011 Prof. Rodger

  2. CSED Week, Dec 4-10Make the pledge – csedweek.org

  3. Dec 7, 6:15pm, LSRC D106

  4. Announcements • No Reading for next time • No Reading quiz • What’s due? • Assignment 7 due today, Dec 6, late by Dec 8 • Apt-06 due Thursday, Dec 8, late by Dec 10 • Cannot turn in anything late after Dec 10 • Assignments are being graded! Really!

  5. Insertion Sort • Maintain a sublist of sorted elements. • For each item one at a time, insert it into the sorted sublist. • N elements total • How long does insertion sort take?

  6. Insertion Sort • 11 8 3 17 22 12 9 5

  7. InsertionSort vs SelectionSort • How do these compare?

  8. Bubblesort • N passes over the list • With each pass compare adjacent pairs and swap if out of order. • Can examine one less element with each pass • “bubble up” the next largest element in sorted order.

  9. Bubble Sort • 11 8 3 17 22 12 9 5

  10. Mergesort • Start with small lists of size 1 each • Merge 2 lists of size 1 into list of size 2 • Merge 2 lists of size 2 into list of size 4 • Merge 2 lists of size 4 into lists of size 8 • Etc.

  11. Mergesort • 11 8 3 17 22 12 9 5

  12. Compare the sorts • Compare with sizes of data, what happens with each sort as the size of the input doubles? • Compare with different types of data • Random data • Reverse order • Almost sorted