Big-O Complexity Flashcards

1
Q

what does O(1) mean

A

O(1) means that the algorithm will always execute in the same time no matter size of input data set.

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

Put these Big-O expression in order of complexity:

O(1)
O(2n)
O(log n)
O(n2)
O(N3)
O(n)
O(n log n)
A
O(1)
O(log n)
O(n)
O(n log n)
O(n2)
O(N3)
O(2n)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Work out this function with Big-O complexity:

2n2 + 3N

A

O(n2)
then another three loops not nested: 2N² + 3N

remove everything except the highest term: 2N²

remove all constants: N²

other words two loops with another one nested inside, then another three loops not nested is O(N²)

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