⇵
Sorting Algorithms
AP Computer Science A · Array Manipulation
⛶ Fullscreen
AP CSA Sorting Algs
The College Board curriculum requires deep understanding of exactly three sorting algorithms.
1. Selection Sort
Finds the absolute minimum in the remaining array and swaps to current front. $O(n^2)$. Always scans whole tail.
2. Insertion Sort
Shifts elements right to make room for current element. Great for nearly-sorted arrays. $O(n^2)$.
3. Merge Sort
Divide & Conquer. Recursively splits array into halves, then merges sorted halves. $O(n \log n)$ but requires memory.
Tags
arrays
sorting
O(N^2)
algorithms
Selection Sort
Comparisons:
0
Array Accesses:
0
Algorithm
Selection Sort
Insertion Sort
Merge Sort
Array Size ($N$)
40
Animation Delay (ms)
20
Shuffle Array
▶ Start Sorting
Color Legend
Unsorted
Comparing
Swapping/Writing
Sorted