Pergunta de entrevista da empresa Google

How to choose pivot in quicksort

Respostas da entrevista

Sigiloso

30 de ago. de 2010

In simple quicksort you use the first element as the pivot. In randomized quicksort, you pick an element at random and swap it to the beinning of the array.

1

Sigiloso

16 de nov. de 2010

median of 3: take first, middle and last element; choose median among these - ensures you never choose the smallest or largest element as your pivot (i.e., make progress on each quicksort iteration).