Big O notation Flashcards

1
Q

Big O notation describes what in an algoritm

A

the performance or complexity of the algorithm. measures how time and space requirements increase as the number of elements increase (not a test of speed)

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

Constant run time complexity

A

0(1), regardless if array contains 10 or 10000 items, run time is the same

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

linear run time complexity

A

O(n) - performance will grow linearly and in direct proportion to the size of the input data set.

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

Algorithm where complexity is directly proportional to the square of the size of the input data set

A

O(n^2)
AKA quadratic run time complexity
- common for sorting algorithms

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

logarithmic run time complexity

A

O(log n) - data used is decreased by approx 50% each pass through the algorithm

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

O(n^c)

A

polynomial time

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

O(n log n)

A

linearithmic time

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

linearithmic time

A

O(n log n)

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

polynomial time

A

O(n^c)

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

exponential time

A

O(2^n)

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

O(2^n)

A

exponential tim

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

factorial time

A

O(n!)

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

run time of sorting and searching algorithms

A

sorting - n^2 unless it is quick sort where it is O(n log(n)) (with a worst case of O(n^2)
searching - n unless it is binary search where it is log(n)

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