Big-O Notation Flashcards

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/20

flashcard set

Earn XP

Description and Tags

Flashcards covering the concepts of Big-O notation, time complexity analysis, and algorithm examples from the lecture notes.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

21 Terms

1
New cards

What is the Big O notation used for in practice?

Calculating the complexity of example algorithms.

2
New cards

What is the Big O notation for T(n) = 1x + 0?

O(N)

3
New cards

What is the Big O notation for T(n) = 2x^2 + 1x + 0?

O(N^2)

4
New cards

What is the Big O notation for T(n) = 3x^3 + 2x^2 + 1x + 0?

O(N^3)

5
New cards

What is the Big O notation for a constant time T(N) = Constant?

O(1)

6
New cards

What is the Big O notation for a linear time T(N) = C1 x N + C2?

O(N)

7
New cards

What is the Big O notation for a logarithmic time T(N) = C1 x log2 N + C2?

O(log N)

8
New cards

What is the Big O notation for a quadratic time T(N) = C1 x N^2 + C2 x N + C3?

O(N^2)

9
New cards

What is the Big O notation for the best case of a linear search?

O(1)

10
New cards

What is the Big O notation for the worst case of a linear search?

O(N)

11
New cards

What is the Big O notation for the average case of a linear search?

O(N)

12
New cards

What is the worst case time complexity of a loop that runs a constant number of times with O(1) expressions inside?

O(1)

13
New cards

Given T1(n) is O(N) and T2(n) is O(M), what is the combined time complexity for sequential loops?

O(max(N, M))

14
New cards

If N is much greater than M, and T1(n) is O(N) and T2(n) is O(M), what is O(max(N, M))?

O(N)

15
New cards

What is the overall time complexity of two nested loops each running N times, with O(1) operations inside?

O(N^2)

16
New cards

What is the time complexity of nested loops where the number of iterations depend on each other?

Careful counting of operations or using Sigma notation

17
New cards

A

A

18
New cards

A

A

19
New cards

A

A

20
New cards

When determining the Big O notation of sequential loops, what should you identify?

Find the dominant term (i.e., the loop that takes the longest)

21
New cards

What is the time complexity of nested loops equal to?

The number of times innermost statement is executed*complexity of statement