4.2.1.3 Heap Sort, Radix Sort
Appearance
4.2.1.3 Heap Sort, Radix Sort
- Heap Sort: This algorithm uses a special data structure called a "heap." A heap is like a tree where each "parent" item is always bigger (or smaller) than its "children" items. Heap Sort builds this special tree, then repeatedly takes the largest (or smallest) item from the top of the heap and puts it into the sorted list.
- Radix Sort: Imagine you're sorting a big stack of student IDs, which are numbers. Instead of comparing the whole numbers, Radix Sort sorts them digit by digit, starting from the rightmost digit (the ones place), then the tens place, then the hundreds place, and so on. It's very efficient for sorting numbers or things that can be represented as numbers.