Your old version
Updated to
25
Sorting method | |
Number of elements | |
Range of values | |
Average expected | |
Average values | |
Tolerance | |
Total time | |
Memory accesses | |
Swaps |
.
Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the input list element by element, comparing the current element with the one after it, swapping their values if needed. These passes through the list are repeated until no swaps have to be performed during a pass, meaning that the list has become fully sorted. The algorithm, which is a comparison sort, is named for the way the larger elements "bubble" up to the top of the list.
Speed | circle circle circle circle |
Efficiency | circle circle circle circle |
Short arrays | circle circle circle circle |
Long arrays | circle circle circle circle |
Selection sort is an in-place comparison sorting algorithm. It has an O(n2) time complexity, which makes it inefficient on large lists, and generally performs worse than the similar insertion sort. Selection sort is noted for its simplicity and has performance advantages over more complicated algorithms in certain situations, particularly where auxiliary memory is limited.
Speed | circle circle circle circle |
Efficiency | circle circle circle circle |
Short arrays | circle circle circle circle |
Long arrays | circle circle circle circle |
Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time by comparisons. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort. Insertion sort iterates, consuming one input element each repetition, and grows a sorted output list. At 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.
Speed | circle circle circle circle |
Efficiency | circle circle circle circle |
Short arrays | circle circle circle circle |
Long arrays | circle circle circle circle |
In computer science, bogosort (also known as permutation sort and stupid sort) is a sorting algorithm based on the generate and test paradigm. The function successively generates permutations of its input until it finds one that is sorted. It is not considered useful for sorting, but may be used for educational purposes, to contrast it with more efficient algorithms.
Speed | circle circle circle circle |
Efficiency | circle circle circle circle |
Short arrays | circle circle circle circle |
Long arrays | circle circle circle circle |
Quicksort is an efficient, general-purpose sorting algorithm. Overall, it is slightly faster than merge sort and heapsort for randomized data, particularly on larger distributions. Quicksort is a divide-and-conquer algorithm. It works by selecting a 'pivot' element from the array and partitioning the other elements into two sub-arrays, according to whether they are less than or greater than the pivot. For this reason, it is sometimes called partition-exchange sort. The sub-arrays are then sorted recursively. This can be done in-place, requiring small additional amounts of memory to perform the sorting.
Speed | circle circle circle circle |
Efficiency | circle circle circle circle |
Short arrays | circle circle circle circle |
Long arrays | circle circle circle circle |