4.3.5 Sorting Algorithms Flashcards

You may prefer our related Brainscape-certified 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

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

Divide and Conquer Algorithm?

A

Merge Sort

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

Time Complexity of Bubble Sort?

A

O ( 1 ) Best case
O ( n^2 ) Worst case

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

What is the time complexity of Merge Sort?

A

O ( n log n )

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

Sort this array into ascending order using bubble :
4 3 5 7 6

A
  1. (4 3) 5 7 6
  2. 3 (4 5) 7 6
  3. 3 4 (5 7) 6
  4. 3 4 5 (7 6)
  5. (3 4) 5 6 7
  6. 3 (4 5) 6 7
  7. 3 4 (5 6) 7
  8. 3 4 5 (6 7)

brackets show switches/checks

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

Sort this array into ascending order using merge:
Tom Sue Jack Bill Ada

A
  1. Tom Sue Jack Bill Ada
  2. Tom Sue Jack | Bill Ada
  3. Jack Sue Tom | Ada Bill
  4. Ada Bill Jack Sue Tom
How well did you know this?
1
Not at all
2
3
4
5
Perfectly