Sorting

Which algorithm works best for largely sorted array?

  • Insertion Sort

  • Bubble Sort

https://stackoverflow.com/a/4276118/3127828

Only a few items => INSERTION SORT

Items are mostly sorted already => INSERTION SORT

Concerned about worst-case scenarios => HEAP SORT

Interested in a good average-case result => QUICKSORT

Items are drawn from a dense universe => BUCKET SORT

Desire to write as little code as possible => INSERTION SORT

Last updated