06. Bubble Sort,Insertion Sort & Selection Sort

06. Bubble Sort,Insertion Sort & Selection Sort -...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 1 / 2 3 / 1 5 1 Sorting (Bubble Sort, Insertion Sort, Selection Sort)
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
1 1 / 2 3 / 1 5 2 Sorting Sorting refers to the operation of arranging data in some given order such as increasing or decreasing with numerical data or alphabetically with character data. Comparison Sort A comparison sort is a sorting technique that reads the list elements and determines which of the two elements should occur first in the final sorted list through a single comparison operation. Some of the most well-known comparison sorts include: 1. Bubble Sort 4. Quicksort 2. Selection Sort 5. Merge Sort 3. Insertion Sort 6. Heap Sort Some examples of sorts which are not comparison sorts include: 1. Counting Sort 2. Radix Sort 3. Bucket Sort
Image of page 2
1 1 / 2 3 / 1 5 3 Bubble Sorting - The bubble sort is the oldest and simplest sort in use. - Unfortunately, it is the slowest sorting technique. - It works by comparing each item in the list with the item next to it, and swapping them if required. - The algorithm repeats this process until it makes a pass all the way through the list without swapping any items. This causes larger values to "bubble" to the end of the list while smaller
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern