A lot of sources don't explain that there is more than one algorithm to partition the elements. Three common implementations are shown here: https://www.geeksforgeeks.org/dsa/quick-sort-algorithm/. CTCI uses Hoare's. You've likely seen the Naive and Lomuto implementations which keep track of the pivot location.