Computer Algorithms II Lecture Notes

2 October 2007 • Performance Estimation


Outline

A Program

string read

while getline(cin, str)
  read += str

for i = 0 to read.size()
  if read[i] == '<'
    // process tag

Another Program

string read

while getline(cin, str)
  read += str
  for i = 0 to read.size()
    if read[i] == '<'
      // process tag
      read[i] = ' '

Making Choices

Measuring Performance

Estimating Performance

Estimating Algorithms

Modeling Algorithms

Sorting Model Example

Database Model Example

Estimating Functions

Upper Bounds

Asymptotic Estimate Properties

Tight Estimates

A Behavior Hierarchy

Constant Behavior

constant behavior

  • This is input-independent behavior

    • This is ideal behavior.

    • But watch out for the value of C.

Logarithmic Behavior

logarithmic behavior

Linear Behavior

linear behavior

Log-Linear Behavior

log-linear behavior

Quadratic Behavior

quadratic behavior

A Family Portrait

Structural Analysis

A Running Example

Statements

if statement

Example if Estimates

Statement Sequence

Example Sequence Estimates

Loops

Loop Overhead

Loop Estimate Example

Finishing Up.

Finishing Up..

Finishing Up...

Subroutines

Constants

Constants Interpreted

Good Constants

Points to Remember


This page last modified on 5 October 2007.

This work's CC license.