Computer Science 332
Analysis of Algorithms

Dickinson College
Spring Semester 2001
Grant Braught

Class #4-6 - Performance Analysis

### Main Ideas For Today

• Space Complexity
• Time Complexity
• Operation Counting
• Step Counting
• Sorts: Rank, Selection, Bubble, Insertion

• Solving Summations: Arithmetic Series, Splitting, Change of Variables
• Solving Recurrence Equations: Substitution

### Reading Assignment For Today

• Data Structures, Algorithms and Applications in Java: Chapter 2

### Presentation Topics

 Topic Text Sections Target Time Overview 2.1, 2.2, 2.3 15 min. Conceptual overview of what is going on. What is performance analysis? What are Time and Space Complexity? Why do we care? (Conceptual examples?) What are instance characteristics? Space Complexity 2.2 20 min. What is Space Complexity? What are the components of Space Complexity? Example 2.5, Exercise 2.7 Operation Counts 2.3.1, 2.3.2 35 min. What are the components of Time Complexity? What are Operation Counts? Think about 2nd sentence of section 2.3.1. Example 2.9 (Arithmetic Series) Examples 2.11, 2.12. Best/Worst/Ave Operation Counts 2.3.3 35 min. What does Best/Worst/Ave Operation Count mean? Examples: 2.13, 2.14, 2,18. Step Counts 2.3.4 35 min. Clarify definition 2.1. What is a program step? What is not a program step? (simple examples?) Example 2.19 Example 2.20 (Recurrence Equations) Profiling Examples 2.3.4 35 min. What is Profiling? How does profiling relate to step counting? Matrix Transpose Example Solving summations with change of variable. Inefficient Prefix Sums Example Solving summations by splitting. Example 2.22

### Homework Assigned Today

Due Date: 2/16/01 (Hand in only the Bold Face Problems)

• Data Structures, Algorithms and Applications in Java
• Chapter 2 - 5, 6, 7, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 32(b), 33(a,c,d), 36(a,b,d)
• Note: In problem 32(b) find the best, worst and average step counts.