Big-O Complexity Hierarchy
Big-O order: O(1) < O(log n) < O(n) < O(n log n) < O(n²) < O(2ⁿ)
Big-O Complexity Hierarchy
From fastest to slowest — know this order cold
📖 Full Lesson →
🎥 Watch Instead
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 Big-O Complexity Hierarchy
Big-O — the common complexities, fastest to slowest?
Tap to flip
🃏 Answer
Big-O order: O(1) < O(log n) < O(n) < O(n log n) < O(n²) < O(2ⁿ)
Big-O Complexity Hierarchy — O(1): constant, always same speed. O(log n): binary search. O(n): one scan. O(n log n): merge sort. O(n²): nested loops. O(2ⁿ): brute force combinations. Choose lowest complexity when possible.
Tap to flip back
Divide and Conquer
Divide and conquer: split problem in half, solve each half, combine. Merge sort, binary search, FFT.
Divide and Conquer
Breaking problems into smaller subproblems recursively
📖 Full Lesson →
🎥 Watch Instead
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 Divide and Conquer
Divide and conquer — the steps and examples?
Tap to flip
🃏 Answer
Divide and conquer: split problem in half, solve each half, combine. Merge sort, binary search, FFT.
Divide and Conquer — Three steps: Divide (split into subproblems), Conquer (solve recursively), Combine (merge solutions). Merge sort: split array in half, sort each half, merge → O(n log n). Binary search: split search space in half each time → O(log n). Master Theorem gives recurrence time complexity.
Tap to flip back
Shortest Path Algorithms
BFS (Breadth-First Search): shortest path in unweighted graph, uses queue. Dijkstra: shortest path with weights, uses priority queue.
Shortest Path Algorithms
Finding the fastest route through a graph
📖 Full Lesson →
🎥 Watch Instead
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 Shortest Path Algorithms
BFS vs Dijkstra for shortest paths?
Tap to flip
🃏 Answer
BFS (Breadth-First Search): shortest path in unweighted graph, uses queue. Dijkstra: shortest path with weights, uses priority queue.
Shortest Path Algorithms — BFS (Breadth-First Search): finds shortest path in unweighted graphs — explores level by level. Dijkstra's algorithm: shortest path in weighted graphs with non-negative weights — uses a min-priority queue, greedy approach. Bellman-Ford: handles negative weights, detects negative cycles — O(VE).
Tap to flip back
Sliding Window Technique
Sliding window: maintain a window of elements, slide it across array — O(n) instead of O(n²)
Sliding Window Technique
Efficiently solving subarray/substring problems
📖 Full Lesson →
🎥 Watch Instead
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 Sliding Window Technique
Sliding window — how does it work, and why is it faster?
Tap to flip
🃏 Answer
Sliding window: maintain a window of elements, slide it across array — O(n) instead of O(n²)
Sliding Window Technique — Fixed window: maintain window of size k, add one element, remove one element each step. Variable window: expand/contract window based on condition. Problems: maximum sum subarray of size k, longest substring without repeating characters. Avoids nested loops — O(n) instead of O(n²).
Tap to flip back
P vs NP
NP-hard (Non-deterministic Polynomial-time hard) problems: no known polynomial solution. Traveling salesman, knapsack, graph coloring.
P vs NP
The most important unsolved problem in computer science
📖 Full Lesson →
🎥 Watch Instead
This lesson's animated video hasn't been made yet — check back soon.
Flashcard
🃏 P vs NP
NP-hard problems — what are they, with examples?
Tap to flip
🃏 Answer
NP-hard (Non-deterministic Polynomial-time hard) problems: no known polynomial solution. Traveling salesman, knapsack, graph coloring.
P vs NP — P: problems solvable in polynomial time. NP: solutions verifiable in polynomial time. NP-complete: hardest problems in NP. P=NP?: if any NP-complete problem has a polynomial solution, all do. Most believe P≠NP. Practical: use approximation algorithms or heuristics for NP-hard problems.
Tap to flip back