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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Maximum number of passes in bubble sort

A

n-1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly