Chapter 05 — Optimizing Code with and Without Big O

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

1/28

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 7:34 PM on 7/29/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

29 Terms

1
New cards
Big O limitation
Big O shows the general growth category, but not exact step counts
2
New cards
Same Big O different speed
Two algorithms can have the same Big O but different actual speeds
3
New cards
Selection Sort
A sorting algorithm that repeatedly finds the lowest value and moves it to the front of the unsorted section
4
New cards
How Selection Sort works
Find the lowest value in the unsorted section, then swap it with the first unsorted value
5
New cards
Selection Sort memory trick
Select the lowest remaining value
6
New cards
Lowest value
The smallest value found during a Selection Sort pass-through
7
New cards
Lowest value index
The index where the current lowest value is located
8
New cards
Selection Sort pass-through
One scan through the unsorted section to find the lowest value
9
New cards
Selection Sort swap
After finding the lowest value, swap it with the first value in the unsorted section
10
New cards
Selection Sort comparisons
Selection Sort compares values to find the lowest remaining value
11
New cards
Selection Sort swap pattern
Selection Sort makes at most one swap per pass-through
12
New cards
Selection Sort Big O
O(N²)
13
New cards
Why Selection Sort is O(N²)
It repeatedly scans the remaining unsorted values for each position
14
New cards
Bubble Sort vs Selection Sort
Both are O(N²), but Selection Sort usually performs fewer swaps
15
New cards
Why Selection Sort can be faster than Bubble Sort
Selection Sort usually swaps once per pass, while Bubble Sort may swap many times
16
New cards
Constant
A fixed number that Big O ignores
17
New cards
Ignoring constants
Big O removes fixed multipliers because it focuses on growth rate
18
New cards
What N² / 2 becomes
O(N²)
19
New cards
What 2N becomes
O(N)
20
New cards
What 100N becomes
O(N)
21
New cards
Big O category
A general speed classification based on how steps grow as input grows
22
New cards
Big O is best for
Comparing algorithms from different growth categories
23
New cards
When Big O is not enough
When two algorithms have the same Big O category
24
New cards
Practical example from Chapter 05
Two even-number printing algorithms are both O(N), but one is faster because it skips odd numbers
25
New cards
Significant steps
The meaningful operations inside an algorithm that contribute to total step count
26
New cards
Step counting
Counting actual operations to compare algorithms more precisely
27
New cards
Big O optimization
Improving the growth category of an algorithm
28
New cards
Non-Big O optimization
Making an algorithm faster without changing its Big O category
29
New cards
Main lesson of Chapter 05
Big O is powerful, but exact step counts still matter when algorithms share the same Big