Time Complexity Flashcards

1
Q

Time stays same no matter how many elements

eg: Array[x] / array.push

A

(1) Constant complexity O(1)

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

Time increases as number of elements increases

eg: for loop

A

(3) Linear complexity O(n)

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

Time increases exponentially as elements increase

eg: nested for loops

A

(5) Quadratic complexity O(n^2)

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

Time complexity is reduced in some way by limiting or dividing the number of elements accessed
(eg: for loop with divide by 2 / binary search)

A

(2) Logarithmic complexity O(log n)

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

Time complexity increases like an exponential loop but is limited by dividing the number of elements
(eg: divide and conquer on an n^2 algorithm )

A

(4) nLogN O(n log n)

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