Basic Sorting Algorithms
Last updated
Last updated
A sorting algorithm that is based upon comparing pairs of values and swapping their places if necessary.
Overall Idea:
Bubble Sort Demonstration:
A sorting algorithm that iterates sorts from the bottom one element at a time.
Overall Idea:
Since a singleton list is already sorted, it will grow its “sorted” list with the next value from the list
It grabs the next value, removes it, and places in the correct location
It does this until the list is fully sorted
Insertion Sort Demonstration:
A sorting algorithm that uses two lists: sorted list and unsorted list.
It brings the smallest values to the sorted list then removed the smallest value in the unsorted list .
Overall Idea:
At beginning, sorted list is empty and unsorted list is full
Choose the smaller(or largest) value from the unsorted list, and append it to the sorted list
Repeat until unsorted list is empty
Selection Sort Demonstration:
The 3 sorting algorithms are learned together due to their Big-O Notation.
All 3 algorithms are classified as .