Lecture notes for CS 503, Advanced Programming I

Lecture Notes for Advanced Programming I

24 January 2006 • Program Design


Outline

  • Big Ideas

  • Design

  • Analysis

  • Testing

    A Problem

    Big Ideas

    Finding Big Ideas

    Recognizing Big Ideas

    The Big Ideas

    Design

    Stepwise Refinement

    Design via Refinement

    Top-Down Design Advantages

    Top-Down Design Problems

    What's the Problem?

    Abstraction

    What's the Solution?

    Now what?

    The Next Problem

    Collinearity

    The Next Solution

    find maximal collinear subset(points)
      max points = { }
      for p1 in points
        for p2 in points - p1
          cpoints = { p1, p2 }
          for p3 in points - cpoints
            if collinear(p1, p2, p3)
    	  cpoints += { p3 }
          if #cpoints > #max points
            max points = cpoints
      return max points
    

    Observations

    Collinearity Revisited

    The Next Solution

    find maximal collinear subset(points)
      max points = { }
      for p1 in points
        order points by increasing angle
        scan for similar angles
          similar angles mean collinear points
          remember the biggest set
      return max points
    

    Other Design Techniques

    Points to Remember


    This page last modified on 31 January 2006.

    This work is covered by a
    Creative Commons License.