big o Flashcards

1
Q

QUICK SORT

worst case time complexity?
worst case space complexity?

A

time - O(n^2)

space - O(log(n))

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

MERGE SORT

worst case time complexity?
worst case space complexity?

A

time - O(n log(n))

space - O(n)

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

BUBBLE SORT

worst case time complexity?
worst case space complexity?

A

time - O(n^2)

space - O(1)

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

INSERTION SORT

worst case time complexity?
worst case space complexity?

A

time - O(n^2)

space - O(1)

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

SELECTION SORT

worst case time complexity?
worst case space complexity?

A

time - O(n^2)

space - O(1)

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

LINEAR SEARCH

worst case time complexity?

A

time - O(n)

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

BINARY SEARCH

worst case time complexity?

A

time - O(log(n))

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

what is the relationship between input size and execution time for O(1)?

A

always executes in the same time regardless of the size of the data set

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

what is the relationship between input size and execution time for O(log(n))?

A

execution time increase is linear when input size is doubled

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

what is the relationship between input size and execution time for O(n)?

A

execution time is proportional to the input size increase

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

what is the relationship between input size and execution time for O(n^x)?

A

execution time increases relating to the highest degree of the polynomial complexity as the input size increases

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

what is the relationship between input size and execution time for O(2^n)?

A

execution time increases exponentially as the input size increases

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

what is the relationship between input size and execution time for O(n!)?

A

execution time increases in a factorial nature related to the input size

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

what is the worst time complexity described by big O notation?

A

O(n!) or factorial time complexity

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

what is the best time complexity described by big O notation?

A

O(1) or constant time complexity

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

what feature of an algorithm commonly has O(log(n))?

A

divide and conquer / halving the input size with every pass

17
Q

what feature of an algorithm commonly has O(n)?

A

iterating through the size of the input

18
Q

what feature of an algorithm commonly has O(n^x)?

A

nested loops, each loop relating to the input size

19
Q

what feature of an algorithm commonly has O(2^n)?

A

recursive functions

20
Q

what feature of an algorithm commonly has O(n!)?

A

trial and error / guessing until a condition is met

21
Q

what is the domain of an algorithm?

A

all possible inputs into the algorithm

22
Q

what is the codomain of an algorithm?

A

all possible outputs of an algorithm

23
Q

what is the range of an algorithm?

A

all of the actual outputs of an algorithm