Order of an Algorithm Flashcards

1
Q

If the size of a problem is increased by some factor k then:

an algorithm of linear order will take approximately ___ times as long to complete

an algorithm of quadratic order will take approximately ___ times as long to complete

an algorithm of cubic order will take approximately ___ times as long to complete.

A

k

k^2

k^3

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

Why is the answer to part (a) an estimate?

TOPIC: order of an algorithm. Use the scenario of quadratic order

A

the quadratic order does not mean the order is proportional to n^2, it could be n^2 + 2n etc. However in part (a) quadratic order is assumed to be just n^2 making our answer an estimate.

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

2019 June A2 question:

For a list of n numbers the quick sort algorithm has an average order nlogn. Given that it takes 2.32 seconds to run an algorithm. When n=450.

Calculate approximately how long it will take to the nearest tenth of a second to run an algorithm when n=11250

A

run time
= 2.32 x (11250log11250 / 450log450)
= 88.6 seconds (nearest tenth)

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

Order of an algorithm

A

is a measure of the efficiency as function of the size

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

Size

A

the measure if its complexity (usually the number of items in the list)

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

Efficiency

A

is a measure of its run time. This is proportional to the number of operations

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