Complexity Analysis Flashcards

1
Q

Accumulation technique

A

Show that n actions cost T(n) so therefore a single action costs T(n)/n

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

Charging technique

A

Ramp up the “price” of using “cheap” operations, that way the “price” of the expensive ones cancel out with the cheaper ones.

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

The potential method

A

Create a function that reflects the potential that the data structure has.
The function for a single action wil be:
C = actual_cost + P(Di) - P(Di-1)
P(Dn) >= P(0)

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

Proving correctness of Potential function

A

To prove the correctness of a potential function:
1. Prove that the value is non negative.
2. Prove that the complexity is as wanted.

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

Dynamic list (idea)

A

We have a list but we don’t know how many items it will have. Solution: double the list’s size every time it is full.

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

Dynamic list analysis

A

Takes O(1) for all actions. Using the charging method, each action costs 3 to pay for all of the items behind it.

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