Sorting Algorithms Comparison
Time and space complexity comparison of sorting algorithms: Bubble, Selection, Insertion, Merge, Quick, Heap, Counting, and Radix Sort with stability notes.
Time and space complexity comparison of sorting algorithms: Bubble, Selection, Insertion, Merge, Quick, Heap, Counting, and Radix Sort with stability notes.
A comparison of sorting algorithms by best, average and worst time, space and stability: bubble, selection, insertion, merge, quick, heap, counting and radix sort, extended with Timsort, introsort, bucket sort and shell sort.
| Name | Best | Average | Worst | Space | Stable |
|---|---|---|---|---|---|
| Bubble Sort | O(n) | O(n^2) | O(n^2) | O(1) | true |
| Selection Sort | O(n^2) | O(n^2) | O(n^2) | O(1) | false |
| Insertion Sort | O(n) | O(n^2) | O(n^2) | O(1) | true |
| Merge Sort | O(n log n) | O(n log n) | O(n log n) | O(n) | true |
| Quick Sort | O(n log n) | O(n log n) | O(n^2) | O(log n) | false |
| Heap Sort | O(n log n) | O(n log n) | O(n log n) | O(1) | false |
| Counting Sort | O(n+k) | O(n+k) | O(n+k) | O(k) | true |
| Radix Sort | O(d(n+k)) | O(d(n+k)) | O(d(n+k)) | O(n+k) | true |
| Timsort | O(n) | O(n log n) | O(n log n) | O(n) | true |
| Introsort | O(n log n) | O(n log n) | O(n log n) | O(log n) | false |
| Bucket Sort | O(n + k) | O(n + k) | O(n^2) | O(n + k) | true |
| Shell Sort | O(n log n) | Depends on gap sequence | O(n^2) for simple gaps | O(1) | false |
The shape of this dataset, read from the data itself: every column, its type and a real value. Agents can use this to plan a query without fetching the whole document.
| Section | Field | Type | Example |
|---|---|---|---|
| algorithms | name | string | Bubble Sort |
| algorithms | best | string | O(n) |
| algorithms | average | string | O(n^2) |
| algorithms | worst | string | O(n^2) |
| algorithms | space | string | O(1) |
| algorithms | stable | boolean | true |
The static files contain the same reference rows as the API, with no API rate limit. Live metadata, such as view counts, may differ. Use the API for content negotiation; use the static files for a cacheable snapshot.
curl "https://yjtoon.com/api/dataset/sorting-algorithms-comparison?format=toon"
const res = await fetch( "https://yjtoon.com/static-data/dataset/sorting-algorithms-comparison.toon" ); const toon = await res.text();
Rate limit: 120 requests per minute per IP, no key and no signup. API reference →