CS 411 Fall 2025 > Outline for September 3, 2025
CS 411 Fall 2025
Outline
for September 3, 2025
Outline
Analyzing Nonrecursive Algorithms [L 2.3, Appendix A]
- Idea
- Analysis of recursive vs. nonrecursive algorithms is usually very different.
- Introductory example: analyze a simple loop.
- Evaluating Summations
- See Appendix A.
- Summing powers of the index of summation.
- Linearity properties.
- Close relationship between summation, definite integral.
- General Plan
- Plan for analyzing nonrecursive algorithms
- Choose way of measuring size of input.
- Choose basic operation.
- Does # of basic ops depend only on the size of the input?
- If it depends on some property of the input, then best/worst/average cases may differ.
- If it depends on something else (pseudorandom number, behavior of device), then perhaps we need to expand our notion of what the input is.
- Set up a summation.
- Evaluate the summation.
- Notes:
- We choose the size measurement (step 1) and the basic operation (step 2) so that our analysis gives us useful information.
- For now, we do steps 4 & 5. In practice, we simplify and/or skip these when we can.
- Plan for analyzing nonrecursive algorithms
- Example: analyze Insertion Sort
- Rule of Thumb. \(k\) nested nontrivial loops: \(\Theta(n^k)\).