CSE 502N Fundamentals of Computer Science - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

CSE 502N Fundamentals of Computer Science

Description:

Divide-and-Conquer Algorithm. Let X be an array of points in P sorted by x-coordinate ... Divide-and-Conquer Alg. ( cont'd) Let d' be the minimum distance ... – PowerPoint PPT presentation

Number of Views:33
Avg rating:3.0/5.0
Slides: 19
Provided by: richards89
Category:

less

Transcript and Presenter's Notes

Title: CSE 502N Fundamentals of Computer Science


1
CSE 502NFundamentals of Computer Science
  • Summer 2006
  • (Some slides modified from David Taylor and
    Richard Souvenir)

2
Course Information
  • http//www.cse.wustl.edu/cse502
  • Instructor Robert Glaubius
  • TA TBA
  • Highlights of course website
  • Office Hours
  • Syllabus
  • Grading
  • Coding Standards

3
Pertinent Quote
  • Computer Science is no more about computers than
    astronomy is about telescopes.- Edsger W.
    Dijkstra

4
Course Overview
  • We will focus on three core classes in the
    undergraduate C.S.curriculum
  • Algorithms and data structures (CSE 241) (50)
  • Sorting, searching, graph problems, and analysis
  • Logic and discrete mathematics (CSE 240) (40)
  • Recurrences, Boolean algebra, proof techniques,
    induction
  • Introduction to digital logic and computer design
    (CSE 260M) (10)
  • Logic design, computer architecture, finite state
    machines
  • Fast-paced introduction to an extremely broad
    field
  • Demands that you independently explore the
    concepts at greater depth
  • Plan on significantly more out-of-class study
    time
  • Ask questions early and often
  • Get your moneys worth out of me!
  • We will quickly build on concepts, so dont get
    behind!

5
Closest-Pair Problem
  • Your company has been asked to design an
    air-traffic control safetysystem by the FAA.
  • The system must identify the closest two
    aircraftout of all the aircraft within radar
    range.
  • For a set P containing n points find the closest
    pair of points (p1, p2), wherethe distance
    between p1 (x1, y1) and p2 (x2, y2) is the
    Euclidean distance

6
What is an algorithm?
  • CLR, pg. 1 An algorithm is any well-defined
    computational procedure that takes some value, or
    set of values, as input and produces some value,
    or set of values, as output. An algorithm is
    thus a sequence of computational steps that
    transform the input into the output.
  • Easy answer Recipe

7
What makes a recipe good?
  • Resulting food is what you said it would be
  • Hopefully, it should taste good
  • Recipe is convenient (fast)
  • These are the same criteria for algorithms
  • Correctness
  • Speed

8
By the end of the summer
  • When given a problem (such as FAA scenario), you
    should be able to
  • Propose fast algorithms
  • Using formal notation
  • Prove the algorithms are correct
  • Determine how fast the algorithms are
  • Determine if youve designed the fastest
    algorithm possible

9
Algorithms
  • Well focus on two criteria for algorithms
  • Correctness
  • Speed
  • How do we know if algorithm is correct?
  • How do we know how fast our algorithm is?
  • What does algorithm speed depend on?
  • Some time function T(?, ?, , ?)
  • What are the units of T?
  • T(n) will be our notation for time of algorithm
    (in number of operations) as a function of the
    input size, n.

10
Suggestions
  • Your company has been asked to design an
    air-traffic control safetysystem by the FAA.
  • The system must identify the closest two
    aircraftout of all the aircraft within radar
    range.
  • For a set P containing n points find the closest
    pair of points (p1, p2), wherethe distance
    between p1 (x1, y1) and p2 (x2, y2) is the
    Euclidean distance

11
Divide-and-Conquer Algorithm
  • Let X be an array of points in P sorted by
    x-coordinate
  • Let Y be an array of points in P sorted by
    y-coordinate
  • Divide Find a vertical line l that bisects P
    into two sets PL (points on left) and PR (points
    on right)
  • Divide arrays X and Y into XL and XR , YL and YR

12
Divide-and-Conquer Alg. (contd)
  • Find closest pair in PL and PR
  • dL closest pair on left side
  • dR closest pair on the right side
  • Let d min(dL, dR)
  • Are we done?

13
Divide-and-Conquer Alg. (contd)
  • Check points around the centerline
  • Only a distance d away from the line
  • Let Y contain these points sorted by y-coordinate

14
Divide-and-Conquer Alg. (contd)
  • Let d be the minimum distance between any two
    points in Y
  • Closest pair is minimum of d and d
  • Is this algorithm correct?
  • Is this algorithm fast?
  • How fast?
  • Can you implement this algorithm?

15
Points in Y
  • How many other points do we need to measure the
    distance to?
  • Y only spans length d on each side of the
    centerline in the x-direction
  • No need to measure distance to any point higher
    than d in the y-direction
  • So, how many points can fit in this d x 2d
    rectangle?
  • Points on one side of line must be at least d
    distance from each other. Why?

16
So how fast is this?
17
Take-Home Message
  • Algorithms place a fundamental limit on the
    scalability of the solution
  • Possible to increase performance by orders of
    magnitude
  • At best, CPU performance doubles every 18 months
    (Moores Law)
  • Elegant algorithms are much easier to analyze and
    implement than ad-hoc solutions

18
Coming Attractions
  • Thursday
  • Running time analysis
  • Calculate worst-case (or expected) performance
  • Saves a lot of implementation effort if the
    algorithm is not scalable
  • Read CLR 3, 4.2 and Rosen 1.8
  • Upcoming
  • Proofs
  • More formally assures that a solution is correct
  • Important for critical applications (air traffic
    control, etc.)
Write a Comment
User Comments (0)
About PowerShow.com