Design for Generative Recursion, and The Cost of Computation - PowerPoint PPT Presentation

1 / 5
About This Presentation
Title:

Design for Generative Recursion, and The Cost of Computation

Description:

A gentle introduction to numerical methods and complexity theory. Binary Search ... Will we need all these assumptions? Binary Search (define (find-root f left ... – PowerPoint PPT presentation

Number of Views:40
Avg rating:3.0/5.0
Slides: 6
Provided by: csR7
Learn more at: http://www.cs.rice.edu
Category:

less

Transcript and Presenter's Notes

Title: Design for Generative Recursion, and The Cost of Computation


1
Design for Generative Recursion,and The Cost of
Computation
  • Or,
  • A gentle introduction to numerical methods and
    complexity theory

2
Binary Search
  • Example from applied math
  • Problem Given f, find r s.t. f(r)0
  • Approach "Binary Search". We're given
  • rleft lt r ltrright
  • f is monotonic, continuous
  • "No need for exact answer"
  • "Just get us a range Range wide"
  • Note Will we need all these assumptions?

3
Binary Search
  • (define (find-root f left right)
  • (cond
  • (lt (- right left) Range) left
  • else
  • (local ((define mid (/ ( left right) 2)))
  • (cond (lt (f mid) 0 (f right))
  • (find-root mid right)
  • else (find-root left mid)))))

4
Termination Argument
  • A good argument for termination is to say exactly
    how many steps are needed to terminate. This
    computation terminates in
  • log_2 (Difference/Range)
  • where Difference is the difference between left
    and right bounds.

5
Time Complexity
  • add m n (on naturals) m recursive calls
  • append l_m l_n m recursive calls
  • Cross l_m l_n mn recursive calls
  • map f l_n n recursive calls, and calls to f
  • find-root ? recursive calls
  • insert l_n upto n recursive calls to insert
  • insert-sort l_n upto nn/2 calls to insert
  • maxi l_n ?
Write a Comment
User Comments (0)
About PowerShow.com