Sorting algorithms Flashcards
1
Q
How does bubble sort work
A
Each pair of item is compared and if the second one is greater they swap
2
Q
Maximum number of passes in bubble sort
A
n-1
3
Q
How does merge sort work
A
Divide the list into n sub lists
Then divide the sub list until only element in the list
Merge the sub list again in the correct order