big o notation Flashcards

learn big o (27 cards)

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

What does Big O notation describe?

A

The performance or complexity of an algorithm in terms of time and space.

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

True or False: Big O notation can provide an exact number of steps an algorithm takes.

A

False

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

Fill in the blank: The notation O(n) represents ______.

A

Linear time complexity.

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

What is the Big O notation for constant time complexity?

A

O(1)

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

Which of the following is an example of logarithmic time complexity?

A

O(log n)

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

What is the time complexity of a binary search algorithm?

A

O(log n)

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

True or False: O(n^2) indicates quadratic time complexity.

A

True

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

What does O(n!) represent?

A

Factorial time complexity.

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

Which Big O notation indicates the worst-case scenario for an algorithm?

A

Big O notation itself represents the worst-case scenario.

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

What is the time complexity of a simple loop that iterates n times?

A

O(n)

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

Fill in the blank: The term ______ describes the space complexity of an algorithm.

A

Big O notation.

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

What is the significance of the constant factors in Big O notation?

A

They are ignored as they do not affect the growth rate.

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

True or False: Big O notation can be used for both time and space complexity.

A

True

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

What is the time complexity of a merge sort algorithm?

A

O(n log n)

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

Which of the following has the highest growth rate: O(n), O(n log n), O(n^2), O(2^n)?

17
Q

What is the time complexity of accessing an element in an array?

18
Q

Fill in the blank: An algorithm that reduces the problem size by half each iteration has a complexity of ______.

19
Q

What is the time complexity of bubble sort in the worst case?

20
Q

True or False: The notation O(n^3) represents cubic time complexity.

21
Q

What is the Big O notation for an algorithm that runs in linear time?

22
Q

Which algorithm has a time complexity of O(n log n) in the average case?

23
Q

What is the space complexity of an algorithm that uses a fixed amount of space regardless of input size?

24
Q

Fill in the blank: The notation O(n^2) is often associated with ______ algorithms.

25
Which of the following notations indicates an exponential growth rate?
O(2^n)
26
What is the time complexity of finding the maximum element in an unsorted array?
O(n)
27
True or False: O(log n) is faster than O(n) for large input sizes.
True