api: "YAML JSON TOON Database" version: 1.0.0 format: json dataset: slug: sorting-algorithms title: "Sorting Algorithms" description: "Comparison of fundamental sorting algorithms with time and space complexity." category: Algorithms category_slug: algorithms tags: "algorithms,sorting,complexity,big-o" view_count: 0 data [8]{name,best,average,worst,space,stable,notes}: "Bubble Sort",O(n),O(n^2),O(n^2),O(1),true,"Simple but inefficient for large inputs." "Selection Sort",O(n^2),O(n^2),O(n^2),O(1),false,"Minimizes swaps; good when write cost is high." "Insertion Sort",O(n),O(n^2),O(n^2),O(1),true,"Efficient for small or nearly sorted datasets." "Merge Sort","O(n log n)","O(n log n)","O(n log n)",O(n),true,"Consistent performance; good for linked lists." "Quick Sort","O(n log n)","O(n log n)",O(n^2),"O(log n)",false,"In-place; widely used in practice." "Heap Sort","O(n log n)","O(n log n)","O(n log n)",O(1),false,"Guaranteed O(n log n); in-place." "Counting Sort","O(n + k)","O(n + k)","O(n + k)",O(k),true,"Only for integers in bounded range." "Radix Sort",O(nk),O(nk),O(nk),"O(n + k)",true,"Sorts by digit position; k = number of digits."