排序
Data Structures & Algorithms · 7 notes
- 3.9 Bubble Sorthistorical
Bubble sort repeatedly scans an array, comparing adjacent elements and swapping out-of-order pairs until the array is sorted.
- 3.11 Heap Sorthistorical
Heap sort builds a heap and repeatedly removes the root while restoring the heap structure. The notes include implementation, tests, and complexity analysis.
- 3.12 Merge Sorthistorical
Merge sort repeatedly divides an array until each part is sorted, then merges the sorted parts to produce the final array.
- 3.13 Insertion Sorthistorical
Insertion sort divides an array into sorted and unsorted parts, taking one element at a time and inserting it into the appropriate position in the sorted part.
- 3.14 Quick Sorthistorical
Quicksort selects a pivot, moves smaller values to one side and larger values to the other, then repeats the process on each partition.
- 3.15 Selection Sorthistorical
Selection sort finds the largest or smallest element on each pass and places it in position, reducing the number of swaps compared with bubble sort.
- 3.16 Sortinghistorical
This page collects notes on bubble, selection, insertion, merge, quick, and heap sort, comparing their time complexity, space complexity, and stability.