Try an algorithm! | ||
---|---|---|
Bubble Sort | ||
This is an in-place sorting algorithm that iterates through the list and swaps adjacent elements if they are in the wrong order, passing through the list until all elements are sorted. | ||
Insertion Sort | ||
This is an in-place sorting algorithm that builds a sorted array one element at a time by extending the sorted size and placing the next element in its correct position. | ||
Selection Sort | ||
This is an in-place sorting algorithm that repeatedly finds the smallest element from the unsorted portion of the list and swaps it with the first unsorted element. | ||
Cocktail Sort | ||
This is a variation of Bubble Sort that sorts in both directions, moving largest elements to the end and smallest elements to the beginning in alternating passes. | ||
Pancake Sort | ||
This is an in-place sorting algorithm that sorts a list using a sequence of prefix reversals (flips), where the largest unsorted element is moved to its correct position by flipping subarrays from the start of the list. | ||
Shell Sort | ||
This is an in-place sorting algorithm that improves Insertion Sort by first sorting elements far apart, then reducing the gap until the list is fully sorted. | ||
Quick Sort | ||
This is an in-place, divide-and-conquer sorting algorithm that selects a pivot, partitions the array into elements smaller and larger than the pivot, and recursively sorts both parts. | ||
Merge Sort | ||
This is an stable, divide-and-conquer sorting algorithm that recursively splits the array into smaller subarrays, sorts them, and then merges them back together. | ||
Heap Sort | ||
This is an in-place sorting algorithm that uses a binary heap data structure to build a max-heap, repeatedly extracting the largest element and placing it in the sorted part of the array. | ||
Bucket Sort | ||
This is an non-comparative, in-place sorting algorithm that divides the input into several equally spaced "buckets," sorts each bucket individually and then combines them again. | ||
Radix Sort | ||
This is an non-comparative, in-place sorting algorithm that sorts numbers digit by digit, starting from the least significant digit and progressing to the most significant digit. | ||
Best Case | Average Case | Worst Case |
Ω(N) | θ(N²) | O(N²) |
Ω(N) | θ(N²) | O(N²) |
Ω(N²) | θ(N²) | O(N²) |
Ω(N²) | θ(N²) | O(N²) |
Ω(N²) | θ(N²) | O(N²) |
Ω(N log(N)) | θ(N log²(N)) | O(N log²(N)) |
Ω(N log(N)) | θ(N log(N)) | O(N²) |
Ω(N log(N)) | θ(N log(N)) | O(N log(N)) |
Ω(N log(N)) | θ(N log(N)) | O(N log(N)) |
Ω(N+K) | θ(N+K) | O(N²) |
Ω(NK) | θ(NK) | O(NK) |