Counting sort initialization of the output array, each take time. Therefore, the time for the whole algorithm is the sum of the times for these steps, . Because it uses arrays of length and , the total space usage of the algorithm is also . For problem instances in which the maximum key value is significantly smaller than the number of items, counting sort can be highly space-efficient, as the only storage it uses other than its input and output arrays is the Count array which uses space . If each item to be sorted is itself an integer, and used as
Stooge sort Stooge sort Stooge sort is a recursive sorting algorithm. It is notable for its exceptional bad time complexity of . The running time of the algorithm is thus slower compared to reasonable sorting algorithms, and is slower than Bubble sort, a canonical example of a fairly inefficient sort. It is however more efficient than Slowsort. The name comes from The Three Stooges. The algorithm is defined as follows: It is important to get the integer sort size used in the recursive calls by rounding the 2/3 "upwards", e.g. rounding 2/3 of 5 should give 4 rather than 3, as otherwise