Lecture notes for CS 503, Advanced Programming I

Advanced Programming I Lecture Notes

25 January 2007 • Programming Economics


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

Algorithms and Programs

Algorithm Analysis

Measuring Performance

Estimating Performance

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

Things to Watch

Estimate Inputs

Estimate Outputs

Understand the Estimate

Points to Remember


This page last modified on 27 January 2006.

This work is covered by a
Creative Commons License.