4.3 Algorithms Flashcards

1
Q

2017 A-Level paper 1

State the time complexity for the bubble sort algorithm in terms of n, where n is the number of items in the list to be sorted. [1]

A

O(n^2)

A. other ways of indicating n^2

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

2017 A-Level paper 1

Explain why the bubble sort algorithm has the time complexity O(n^2) [2]

A

In each pass through the list n items will be examined;
There will be (at most) n passes through the list;

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