Big O Flashcards

1
Q

What is Big O?

A

Big 0 time is the language and metric we use to describe the efficiency of algorithms.

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

What is Time Complexity?

A

The upper time that an algorithm can take to finish

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

What is Space Complexity?

A

The upper space that an algorithm can take to finish

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

When should I add the runtimes?

A

If your algorithm is in the form “do this, then, when you’re all done, do that” then you add the runtimes.

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

When should I multiply the runtimes?

A

If your algorithm is in the form “do this for each time you do that” then you multiply the runtimes.

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

What is Amortized Time?

A

When the array hits the capacity, the ArrayList will create a new one with double the capacity. It allows us to describe that, yes, this worst case happens every once in a while. But once it happens, it won’t happen again for so long that the cost is “amortized.”

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

Log N Runtimes

A

When you see a problem where the number of elements in the problem space gets halved each time, that will likely be a 0(log N) runtime.

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

Recursive Runtimes

A

When you have a recursive function that makes multiple calls, the runtime will often (but not always) take like O(branches ^ (N+1)), where branches are the number of times each recursive call branches. In this case, this gives us 0( 2”).

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