Quicksort con el primer elemento como ejemplo de pivote
Actualmente estoy estudiando quicksort y me gustaría saber cómo funciona cuando se elige el primer (o último) elemento como punto de pivote.
Por ejemplo, tengo la siguiente matriz:
{15, 19, 34, 41, 27, 13, 9, 11, 44}
Esto es lo que creo que sucede:
{15, 19, 34, 41, 27, 13, 9, 11, 44}
^
pivot
{15, 19, 34, 41, 27, 13, 9, 11, 44}
^ ^
compare these two, they are good
{15, 19, 34, 41, 27, 13, 9, 11, 44}
^ ^
compare these two and swap
{11, 19, 34, 41, 27, 13, 9, 15, 44}
^ ^
compare these two and swap
{9, 19, 34, 41, 27, 13, 11, 15, 44}
^ ^
compare these two, they are good
{9, 19, 34, 41, 27, 13, 11, 15, 44}
^ ^
compare these two, they are good
{9, 19, 34, 41, 27, 13, 11, 15, 44}
^ ^
compare these two, they are good
{9, 19, 34, 41, 27, 13, 11, 15, 44}
^ ^
compare these two, they are good
{9, 19, 34, 41, 27, 13, 11, 15, 44}
^ ^
compare these two, they are good
{9, 19, 34, 41, 27, 13, 11, 15, 44}
End of first partition
¿Así es como funciona? Si es así, ¿sería 19 el nuevo punto de pivote, o divide la matriz por la mitad para encontrarlo (de modo que sea 27/13), o depende de la implementación del ordenamiento rápido? ¡Gracias por tu tiempo