Which sorting algorithm repeatedly swaps adjacent items that are out of order?
AnswerBubble sort
Bubble sort passes through a list swapping neighbors, so large items bubble to the end.
Coding · Facts & stats
7 fact-checked facts about algorithms, each with the reason behind it. 5 more are in today's round and join this page after it closes.
AnswerBubble sort
Bubble sort passes through a list swapping neighbors, so large items bubble to the end.
AnswerStack
Like a stack of plates, the last item pushed onto a stack is the first removed.
AnswerAl-Khwarizmi
It derives from the Latinized name of the 9th-century Persian mathematician Muhammad ibn Musa al-Khwarizmi.
AnswerO(n log n)
Merge sort splits the list in half repeatedly and merges, taking n log n time in all cases.
AnswerQueue
A queue works like a line of people: the first to join is the first served.
AnswerO(n²)
Quicksort averages O(n log n) but degrades to O(n²) when pivots split the list very unevenly.
AnswerThe greatest common divisor of two numbers
Euclid's algorithm repeatedly takes remainders to find the largest number dividing both inputs.