Bubble Sort Flashcards

(2 cards)

1
Q

How does bubblesort work?

A

Makes comparisons and swaps between pairs of elements.

starts with the first element and compares with the second if the second is smaller then they swap

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

Downsides of bubblesort

A

Will compare pairs that dont need to be compared

Fairly slow

time complexity of O(n^​2​)​.

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