Asymptotic Analysis (Hard) Flashcards

1
Q

Four Number Sum

A

Time:
O(n^2) average
O(n^3) worst

Space: O(n^2)

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

SubArray Sort

A

Time:
O(n)

Space:
O(1)

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

Same BSTs

A

Time:
O(n^2)

Space:
O(n^2)
(but O(d) is technically possible)

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

Largest Range

A

Time:
O(n)

Space:
O(n)

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

Min Rewards

A

Time:
O(n)

Space:
O(n)

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

Zigzag Traverse

A

Time:
O(n)

Space:
O(n)

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