0% found this document useful (0 votes)
5 views1 page

Sorting Algorithms Complexity Summary

The document provides a comparison of various sorting algorithms, detailing their time complexities (best, average, and worst cases) and space complexities. Algorithms covered include Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, Quick Sort, Heap Sort, Counting Sort, Radix Sort, Bucket Sort, and Tim Sort. Each algorithm is briefly described, highlighting its primary method of sorting.

Uploaded by

kumarvigyan03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Sorting Algorithms Complexity Summary

The document provides a comparison of various sorting algorithms, detailing their time complexities (best, average, and worst cases) and space complexities. Algorithms covered include Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, Quick Sort, Heap Sort, Counting Sort, Radix Sort, Bucket Sort, and Tim Sort. Each algorithm is briefly described, highlighting its primary method of sorting.

Uploaded by

kumarvigyan03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Sorting Algorithms - Time and Space Complexities

Algorithm Best Average Worst Space Description

Bubble Sort O(n) O(n²) O(n²) O(1) Swaps adjacent elements repeatedly.

Selection Sort O(n²) O(n²) O(n²) O(1) Selects min element and places at front.

Insertion Sort O(n) O(n²) O(n²) O(1) Inserts elements into correct position.

Merge Sort O(n log n) O(n log n) O(n log n) O(n) Divide and merge in sorted order.

Quick Sort O(n log n) O(n log n) O(n²) O(log n) Partitions array using pivot.

Heap Sort O(n log n) O(n log n) O(n log n) O(1) Uses a binary heap to sort.

Counting Sort O(n+k) O(n+k) O(n+k) O(k) Counts frequency of each element.

Radix Sort O(nk) O(nk) O(nk) O(n+k) Sorts by each digit (LSD to MSD).

Bucket Sort O(n+k) O(n+k) O(n²) O(n+k) Distributes elements into buckets.

Tim Sort O(n) O(n log n) O(n log n) O(n) Hybrid of merge and insertion sort.

You might also like