This challenge is intended to be solved by sorting, ordering, or otherwise organizing some set of data.
A challenge with this tag must at least define some sort of well-ordering to allow programs to sort a list of data.
To learn more about sorting and sorting algorithms, see Wikipedia's article. It includes a list of popular sorting algorithms:
- Simple sorts:
- Insertion sort works by taking elements one by one from the original list and putting them into a new list in sorted order
- Selection sort works by finding the smallest value and swapping it with the element in the first position
- Efficient sorts:
- Merge sort
- Heapsort is a selection sort where the smallest value is found via a heap.
- Quicksort
- Bubble sort and variants:
- Bubble sort works by iterating through the list and comparing two adjacent values, swapping if they are out of order.
- Shell sort
- Comb sort works by eliminating "turtles" (ie out of order elements at the end of the list) before bubble-sorting.
- Distribution sort includes:
- Counting sort
- Radix sort
Other sorts:
- Bogosort works by randomizing the list until it is in proper order. It is comparable to throwing a deck of cards in the air and collecting them together again until it is sorted. Bogosort has a number of related algorithms:
- Gorosort works by randomly permuting subsets of the list.
- Bogobogosort works by applying bogosort on the first two elements of the list, then the first three, and so on, but it starts over at the first two elements if the section of the list it randomized was not sorted.
- Stooge sort
- Pancake sort is sorting by flipping a stack of pancakes. A "spatula" is inserted anywhere in the stack and the stack of "pancakes" above that is flipped.