4.3.5 Sorting Algorithms Flashcards
1
Q
Which Sorting Algorithm is more efficient :
Bubble or Merge
A
Merge Sort
Merge has O ( n log n) Bubble is O (1) best case and O (n^2) worst case
2
Q
Divide and Conquer Algorithm?
A
Merge Sort
3
Q
Time Complexity of Bubble Sort?
A
O ( 1 ) Best case
O ( n^2 ) Worst case
4
Q
What is the time complexity of Merge Sort?
A
O ( n log n )
5
Q
Sort this array into ascending order using bubble :
4 3 5 7 6
A
- (4 3) 5 7 6
- 3 (4 5) 7 6
- 3 4 (5 7) 6
- 3 4 5 (7 6)
- (3 4) 5 6 7
- 3 (4 5) 6 7
- 3 4 (5 6) 7
- 3 4 5 (6 7)
brackets show switches/checks
6
Q
Sort this array into ascending order using merge:
Tom Sue Jack Bill Ada
A
- Tom Sue Jack Bill Ada
- Tom Sue Jack | Bill Ada
- Jack Sue Tom | Ada Bill
- Ada Bill Jack Sue Tom