Mental Model
Partition rearranges elements around a pivot so smaller go left and bigger go right. Lomuto uses one pointer scanning forward, Hoare uses two pointers scanning inward.
Analogy: Imagine sorting books on a shelf by height. Lomuto picks a book and moves through the shelf placing shorter books to the left and taller to the right. Hoare uses two people starting at each end swapping books that are out of place until they meet in the middle.
Array: [5, 3, 8, 4, 2] Pivot chosen (Lomuto): 2 (last element) Pointers: Lomuto: i and j scanning right Hoare: i from left, j from right Initial: [5, 3, 8, 4, 2] i,j -> start After partition: [2, 3, 8, 4, 5] Pivot at correct place