In this Quicksort algorithm, it uses the pivot in the first location of each list. I am having difficulty understanding how to do this algorithm. When I look at examples online, and work out the problem(s) myself, it seems like the book does it differently, and I'm not sure what is the problem. I am unable to get the first pass correct that matches in the text. I added my first pass attemps below. Any help appreciated. Thanks.
First Example:
Original List: [6,2,4,7,1,3,8,5]
First pass in the text: [5,2,4,1,3,6,8,7]
Second pass in the text: [3,2,4,1,5,6,8,7]
My first pass attempt: [3,2,4,5,1,6,8,7]
Second Example:
Original List: [15,4,10,8,6,9,16,1,7,3,11,14,2,5,12,13]
First pass in the text: [13,4,10,8,6,9,1,7,3,11,14,2,5,12,15,16]
Second pass in the text: [12,4,10,8,6,9,1,7,3,11,2,5,13,14,15,16]
My first pass attempt: [12,4,10,8,6,9,13,1,7,3,11,14,2,5,15,16]