This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: D ATA A BSTRACTION 5 GEORGE WANG email@example.com Department of Electrical Engineering and Computer Sciences University of California, Berkeley June 28, 2010 1 Administrivia We apologize for all the corrections done for the homework. We didnt do a good enough job beta testing the homework before we released it. Weve learned our lesson, and were aiming to do a much better job for your future homeworks. 1.1 Addendum to Cheating Policy Sorry for not making this clear. I wanted you to know how the cheating policy for this course worked. Although I spoke at length about what constituted cheating and how were trying to prevent you from cheating, I didnt talk about what the penalties were for cheating. If you cheat on the homework, well give your first offense -4/0. After that, its an automatic F. If you cheat on projects or exams, its an automatic F. We want you to know that we are practically always available one way or another (via email if nothing else), and that if you start early, there is no reason you should need to resort to cheating. Furthermore, you are encouraged to collaborate on homework so long as you note where you are getting help. The first project, however, is an individual programming assignment, just so you know. 2 Review from Last Week We talked about the Syntax of Scheme. Ill list all the functions you should know by today, but if youre missing any take time to review the other lecture notes later. This is in no particular order. lambda, let, every, keep, accumulate, first, butfirst, word, bf, last, butlast, bl, word, quote, equal?, if, cond , member?, +, -, /, * , repeated, count, empty? 1 2.1 Runtime of an Algorithm Consider the insertion sort algorithm you did as homework. What we want to make sure we understand is the runtime of each section of it. So, lets look at insert first. What is the runtime there? Well, whatever it is, well multiply that runtime by the length of the unsorted-sent. To see why, imagine we are trying to do something that takes us 8 hours per day. Say we work for 30 days. How long have we spent? Well, for each of those 30 days, we do 8 hours of work, so we do 30 8 = 240 hours of work. This is the same thing. For each element of the unsorted sentence, we must do an insertions worth of work....
View Full Document