Deck 1: Big O

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/14

encourage image

There's no tags or description

Looks like no tags are added yet.

15 Terms

1
New cards

What does O(1) mean?

Constant time. Runtime does not increase as n increases.

2
New cards

What does O(log n) mean?

Logarithmic time. Problem size is repeatedly halved.

3
New cards

What does O(n) mean?

Linear time. Runtime increases proportionally with n.

4
New cards

What does O(n²) mean?

Quadratic time. Common with nested loops

5
New cards

What does O(n³) mean?

Cubic time. Often caused by triple nested loops

6
New cards

What does O(n log n) mean?

Log-linear time. Better than O(n²), worse than O(n).

7
New cards

What does O(2ⁿ) mean?

Exponential time. Growth becomes extremely large as n increases.

8
New cards

What is the complexity of Linear Search?

O(n) May need to examine every element.

9
New cards

What is the complexity of Binary Search?

O(log n) Half the remaining elements are discarded after every comparison.

10
New cards

Requirement for Binary Search?

The data must be sorted.

11
New cards

Complexity of Quick Sort (average)?

O(n log n)

12
New cards

Complexity of Quick Sort (worst case)?

O(n²)

13
New cards

Complexity of searching a balanced BST?

O(log n)

14
New cards

Complexity of searching a degenerate BST?

O(n)

15
New cards

Which complexity grows fastest?

O(2ⁿ)