Mental Model
Quick Sort splits the list into smaller parts around a pivot, sorts each part, then combines them to get a sorted list.
Analogy: Imagine sorting a pile of cards by picking one card as a divider, putting smaller cards on one side and bigger cards on the other, then sorting each side separately.
Unsorted array: [ 7, 2, 5, 3, 9 ] Pivot chosen: [ 7, 2, 5, 3, 9 ] ā Split into parts: [ 2, 5, 3, 7 ] [ 9 ] Sort parts recursively and combine: [ 2, 3, 5, 7 ] [ 9 ] Final sorted: [ 2, 3, 5, 7, 9 ]