Sort Algorithms Flashcards
A simple (and relatively) slow sorting algorithm that repeatedly loops through al its of values, comparing adjacent values and swapping them if they are in the wrong order.
Stable.
Avg Runtime O(N^2)
Bubble Sort
A type of sort that used a nested loop process to systematically find the best place in the current array for an unsourced item.
Uses a shift and insert technique
Stable
Avg RunTime O(N^2)
Insertion Sort
A recursive algorithm that continually splits a list in half, until each half is either empty or one item, at which point the two halves are merged together in natural order, back up to the division process until the entire list has been sorted.
Stable
Avg Runtime: O(N log N)
Merge Sort
Sometimes called partition-exchange sort, is an efficient sorting algorithm, serving as a systematic method for placing the elements of an array in order.
Not stable.
Avg Runtime: (N log N)
Quick Sort
A sorting routine that uses a nested loop process to systematically select the best value among the unsourced elements of the array for the next position in the array, starting with position zero all the way to the end.
Stable
Avg RunTime: O(N^2)
Uses a Swap Technique - swapping two values if one is better.
Selection Sort
An algorithm uses to arrange elements of an array into natural order, such as numeric or alphabetical.
Sort
The process in sort routines of exchanging two values in an array, using a temporary variable, taking three steps to execute.
Swap