Functional Problem Solving (CSC 151 2014F) : EBoards

CSC151.01 2014F, Class 46: Binary Search


Overview

Preliminaries

Admin

Upcoming Work

Extra Credit Opportunities

Academic

Peer Support

Notes on Quiz 11

Project Questions

We're drawing/selecting polygons with turtles. We realize that in order to get it to scale we would have to change the angels of our polygons so that they would no longer follow the (/ 360 sides) formula. What should we do?

Note that you would also have to change the length of each side. But both figuring out the angles and figuring out the side length is not reasonable. Hence, I am comfortable as long as your scaling works within the same aspect ratio, even if it does not work with different aspect ratios. (E.g., if the image goes from 100x100 to 200x200 or from 100x200 to 200x400, the turtle portions should scale correctly, but if it goes from 100x100 to 200x100 or 100x200, then the turtle portions do not need to scale correctly.) I'd recommend that you base your side length on either the minimum, maximum, or average of the dimensions of the image.

What about image-compute-pixels?

Now called image-recompute! (image-recompute! image (lambda (x y) color))

Also image-redo! (image-redo! image (lambda (x y color) newcolor))

Both should work on only what's selected.

Didn't you promise us code that would select based on a turtle?

Yes. And I sent it to you a while ago.

Questions

Preflection

Two minutes with your partner

Algorithms and algorithm design

Binary search

A demo: Destructive binary search

Binary search in Scheme: Considering the parameters to binary search

Remaining Questions

_Could you go over vector-sorted??

Lab