CSE310 Exam Review
Comprehensive Study Guide
Modules 1, 2, and 6 - Algorithm Analysis Fundamentals
Problems & Algorithms
Core definitions, algorithm properties, and complexity analysis fundamentals
Asymptotic Notations
Big O, Omega, Theta notations and summation analysis techniques
Decision Trees & Sorting
Tree construction, lower bound proofs, and algorithm comparison
Course Overview
Module 1: Problems, Instances, Solutions, Algorithms
Module 2: Asymptotic Notations
Module 6: Decision Trees & Sorting Lower Bound
Module 1: Fundamental Definitions
Problem
Examples:
- Sorting: arrange n numbers in non-decreasing order
- Searching: find target element in a collection
- Graph traversal: find path between vertices
- String matching: locate pattern in text
Instance
Examples:
- Sort array [3, 1, 4, 2]
- Find 7 in [2, 5, 7, 9, 12]
- Find path from A to D in specific graph
Solution
Examples:
- [1, 2, 3, 4]
- Index 2
- Path: A→B→D
Algorithm
Examples:
- Merge Sort
- Binary Search
- Dijkstra's Algorithm
Algorithm Properties & Requirements
Correctness
Produces the correct output for every valid input
Finiteness
Must terminate after a finite number of steps
Definiteness
Each step must be precisely and unambiguously defined
Input
Zero or more quantities that are externally supplied
Output
One or more quantities with specified relation to inputs
Time & Space Complexity Analysis
Time Complexity
Space Complexity
Example: Linear Search
Practice Problem Set 1: Algorithm Analysis
Problem:
Analyze the following recursive algorithm:
a) What problem does this algorithm solve?
b) Write the recurrence relation for time complexity
c) Solve the recurrence using Master Theorem
Solution:
Part A: This algorithm finds the maximum element in an array using divide-and-conquer approach
Part B: T(n) = 2T(n/2) + O(1)
Base case: T(1) = O(1)
Part C: Using Master Theorem: a=2, b=2, f(n)=O(1)
log₂(2) = 1, and f(n) = O(n⁰)
Since 0 < 1, this is Case 1: T(n) = Θ(n¹) = Θ(n)
Practice Problem Set 2: Asymptotic Analysis
Problem:
For each function, determine the tightest asymptotic bound:
Solutions:
Part A: f₁(n) = Θ(n³)
The cubic term 5n³ dominates for large n
Part B: f₂(n) = Θ(n²log n)
n²log n grows faster than n^1.5 = n√n
Part C: f₃(n) = Θ(n)
2^(log₂ n) = n, and n dominates (log₂ n)²
Part D: f₄(n) = Θ(n²)
∑(i=1 to n) (n-i+1) = ∑(k=1 to n) k = n(n+1)/2 = Θ(n²)