Quick Sort

Quick Sort is a sorting algorithm that works by selecting a pivot from a list, and then reordering the list so that all of the elements that are smaller than the pivot go to the left, and all of the elements that are larger than the elements go to the right. Quick sort then recursively applies this algorithm to each of the smaller/larger sublists until the pivots have reached their correct sorted position in the list. The point where a recursize operation terminates in a quick sort is called the partition operation.

[Example] [Example]
[Resource] [Resource]

Performance
Worst case performance O(n2)
Best case performance Ω(n log n)
Average case performance O(n log n)

Step by Step

Merge Sort

A Merge Sort is a sorting algorithm that works by dividing an unsorted list into sublists that all contain 1 element, and then by repeatedly merging these sublists until there is only 1 sorted list remaining. Merging sorted sublists(single element sublists are always sorted) is very efficient because it only requires one comparison between the current elements of either sublist to add an element to the merged list.

[Example] [Example]
[Resource] [Resource]

Performance
Worst case performance O(n log n)
Best case performance Ω(n log n)
Average case performance Θ(n log n)

Step by Step

Insertion Sort

Insertion sort is a sorting algorithm runs through each element of a list, consuming one element upon each repetition, and growing a sorted sublist. Upon each iteration, insertion sort removes one element from the input data, finds the location it belongs within the sorted list, and inserts it there. It repeats until no input elements remain.

[Example] [Example]
[Resource] [Resource]

Performance
Worst case performance О(n2)
Best case performance Ω(n)
Average case performance О(n2)

Step by Step

Selection Sort

Selection Sort is a sorting algorithm that sorts a list from left to right by taking the smallest(or largest, depending on sorting order) unsorted value and swapping it with the leftmost unsorted value upon each iteration. Once the value is swapped with the leftmost unsorted values, it is then considered a sorted value, and after the algorithm has done this for every value in the list, then the entire list will have been sorted.

[Example] [Example]
[Resource] [Resource]

Performance
Worst case performance О(n2)
Best case performance Ω(n2)
Average case performance Θ(n2)

Step by Step

selection sort step by step

Bubble Sort (Sinking Sort)

A Bubble Sort is a sorting algorithm that compares two adjacent data at a time and swaps them if they are in the incorrect order. It runs through the list of data to be sorted until there are no more swaps that need to be done. It is a very slow yet simple algorithm.

[Example] [Example]
[Resource] [Resource]

Performance
Worst case performance O(n2)
Best case performance Ω(n)
Average case performance O(n2)

Step by Step

bubble sort step by step