MergeSort and RadixSort-Heaps Flashcards
(5 cards)
How does MergeSort work?
Recursively divides the array, sorts each half, then merges the sorted halves.
Time complexity: O(n log n), stable, not in-place.
What is Radix Sort?
A non-comparison sorting algorithm that sorts data by processing individual digits or characters, starting with the least significant digit.
Time complexity: O(nk), where k is the number of digits.
When is Radix Sort preferable?
When sorting large datasets of integers or strings with fixed maximum length.
What is a Heap?
A complete binary tree satisfying the heap property: each parent is greater (max-heap) or smaller (min-heap) than its children.
How does HeapSort work?
Builds a heap, repeatedly removes the max (or min), and rebuilds the heap.
Time complexity: O(n log n), not stable, in-place.