2.3.1 Analysis, Design & Comparison of Algorithms Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

State two pieces of information used to analyse an algorithm.

A

Time complexity
Space complexity

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

What is meant by time complexity?

A

How much time an algorithm requires to solve a particular problem

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

How is time complexity measured?

A

Using big-o notation

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

What does big-o notation show?

A

The time taken relative to the number of data elements given as an input

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

How can big-o notation be used?

A

To predict the amount of time taken to solve an algorithm given the number of elements stored

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

What is the name given to O(1)?

A

Constant time complexity

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

What is the name given to O(n)?

A

Linear time complexity

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

What is the name given to O(n²)?

A

Polynomial time complexity

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

What is the name given to O(nⁿ)?

A

Polynomial time complexity

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

What is the name given to O(2ⁿ)?

A

Exponential time complexity

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

What is the name given to O(log n)?

A

Logarithmic time complexity

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

What is the name given to O(n log n)?

A

Linearithmic time complexity

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

Describe what is meant by O(1).

A

The amount of time taken to complete an algorithm is independent from the number of elements inputted

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

Describe what is meant by O(n).

A

The amount of time taken to complete an algorithm is directly proportional to the number of elements inputted

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

Describe what is meant by O(n²).

A

The amount of time taken to complete an algorithm is directly proportional to the square of the elements inputted

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

Describe what is meant by O(nⁿ).

A

The amount of time taken to complete an algorithm is directly proportional to the elements inputted to the power of n

17
Q

Describe what is meant by O(2ⁿ).

A

The amount of time taken to complete an algorithm will double with every additional item

18
Q

Describe what is meant by O(log n).

A

The amount of time taken to complete an algorithm will half with every additional item

19
Q

What is a logarithm?

A

An operation that determines how many times a certain (base) number is multiplied by itself to reach another number

20
Q

What is meant by space complexity?

A

The amount of storage an algorithm takes

21
Q

How can space complexity be reduced?

A

By performing all of the changes on the original pieces of data

22
Q

How can time complexity be reduced?

A

By reducing the number of embedded loops where possible

23
Q

What time complexity does a linear search algorithm have?

A

O(n)

24
Q

What time complexity does a binary search algorithm have?

A

O(log n)

25
Q

What time complexity does a bubble sort algorithm have?

A

O(n²)