06. Bubble Sort,Insertion Sort & Selection Sort

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

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

1 1 / 2 3 / 1 5 1 Sorting (Bubble Sort, Insertion Sort, Selection Sort)

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

View Full Document
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
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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern