DSA 04 - martinbalke-401-adavanced-js/seattle-javascript-401n14 GitHub Wiki

#Sorting Methods

Insertion Sort

Insertion sort is best used on very small arrays because it has a time complexity of O(n2). In this method the array is sorted in place, if the current index is larger it is left where it is, and if it is smaller it is sorted to the back of the array until it fits in to the spot it belongs.

Merge Sort

Merge sort takes an array and splits it down until it is a subset of arrays that are only one index large. Then it recursively merges those arrays back together sorting them each time until only one array remains

Quick Sort

Quick sort choose a pivot, it then sorts all of the items in the array to the left if they are smaller or to the right if they are bigger. It repeats this operation recursively until the array is sorted.