Pergunta de entrevista da empresa Google

Which is the quicker sort 'bubblesort' or 'quicksort' ?

Resposta da entrevista

Sigiloso

12 de out. de 2017

Initially, for a small unsorted population, Bubble Sort will appear efficient. However, as the population grows, Quick Sort performs much better and Bubble Sort loses performance greatly. This can be seen as time complexities for both: Quick Sort = average case O(n log n) Bubble Sort = average O(n^2) Quick Sort's worst case is the same as Bubble Sort's average case, which is O(n^2)