Heap sort is a comparison-based sorting algorithm that uses a binary heap data structure. It has guaranteed $O(n \log n)$ time complexity and sorts in-place. Algorithm Overview Build Max Heap: Convert array into max heap Extract Max: Repeatedly remove max element and rebuild heap Key Properties Time: $O(n \log n)$ for …
Read MoreMerge sort is a stable, comparison-based sorting algorithm that uses the divide-and-conquer paradigm to sort elements in $O(n \log n)$ time. Algorithm Overview Divide and Conquer Strategy Divide: Split array into two halves Conquer: Recursively sort each half Combine: Merge the two sorted halves Mathematical …
Read MoreQuick sort is an efficient, in-place, comparison-based sorting algorithm that uses divide-and-conquer. It has $O(n \log n)$ average time complexity but $O(n^2)$ worst case. Algorithm Overview Divide and Conquer Strategy Partition: Choose a pivot and partition array so that: Elements ≤ pivot are on the left Elements …
Read More