question about Quick Sort

Hello all.

I'm sure you all are familiar with the quick sort algoritem, but I'm still gonna post it in short:

Code:

`IF left < right THEN`

BEGIN

pivot := partition (list, left, right);

Quicksort (list, left, pivot-1);

Quicksort (list, pivot + 1, right);

END

In the partition function, the norm is to usually pick the first number in the array as the pivot, right? But if you choose the last one as the pivot, the loop can become endless. How does that happen?

Thanks in advance