Big O Notation Flashcards

1
Q

what is n

A

the size of the input

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

what two things are considered whenh analysing 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 time complexity

A

the amount of time it takes to run an algorithm

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

what three cases may be found when analysing the time cpmplexity of an algorithm

A
  • best case
  • average case
  • worst case
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is meant by best case

A

the complexity of solving the problem with the best input

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

what is meant by average case

A

the average comlexity of solving a problem

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

what is meant by worst case

A

the complexity of solving a problem for the worst size input

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

what is the time complexity of a linear search alogirthm

A

O(n)

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

what is the time complexity of a binary search alogirthm

A

O(log n)

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

what is the time complexity of a binary tree search alogirthm

A

O(log n)

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

what is the time complexity of a bubble sort alogirthm

A

O(n^2)

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

what is the time complexity of a merge sort alogirthm

A

O(n log n)

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

what is meant by an intractable problem

A

a problem that cannot be solved in a reasonable amount of time but can be solved

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

what approach might a programmer take if asked to “solve” an intractable problemn

A

use hiuristic methods whic make estimates based on experience

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

explauin why the bubble sort has a time complexity of O(n^2)

A

there is a loop within a loop

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

explain why a linear search has a time complexity of O(n)

A

the number of iterations is dependant on how many items are in the array