9
CS 360 Lab 1 Professor: Krzysztof Nowak TA: Mark Boady

CS 360 Lab 1

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CS 360 Lab 1

CS 360 Lab 1 Professor: Krzysztof Nowak

TA: Mark Boady

Page 2: CS 360 Lab 1

Lab Overview �  50 minute lab session

�  Work in Teams (Individual submission) �  I need a copy of the lab for each STUDENT

�  Grading: �  Written Questions are graded after submission

�  Experimental Questions are shown and graded in class

�  I will sign off on all members of the team at once.

Page 3: CS 360 Lab 1

Late Submission �  You may submit the lab

�  At the end of class

�  In my office hours CLC (UC 147) �  Thursday 12-2PM

�  Thursday 4:30-6:30PM

�  At the start of the next lab

�  Missed Class �  If you miss class, you can make up work either in my

office hours or email me to schedule a special time

Page 4: CS 360 Lab 1

Grading �  Professor Grades

�  Exam and Midterm

�  TA Grades �  Homeworks �  Quizzes �  Labs

�  Programming Assignments

Page 5: CS 360 Lab 1

Lab 1: Part 1 �  Document and Test

�  member and insert from member-insert.scm �  maxmin from maxmin.scm �  msort from msort.m

�  Document �  Write description of function in space provided on lab

sheets (2-3 sentences)

�  Test �  On tux run 2-3 tests for the function and show them

to me

Page 6: CS 360 Lab 1

(define (order L)

(if (and (not (null? L)) (not (pair? L)))

0

(+ 1 (reduce max 0 (map order L)))))

Documentation for Order

Compute the order of an object (maximum depth). The order of an atom is 0.The order of a list is 1 plus the maximum order of its elements.

In General try to answer

What does the function do? What is the base case? What is the recursion?

Page 7: CS 360 Lab 1

Lab 1 Part 1

Page 8: CS 360 Lab 1

Lab 1 Part 2 �  Tail and Non-Tail recursive versions of

�  Factorial n! �  2^n �  2^(n!) using composition function in lab

�  Remember you can use a helper function to make a tail and non-tail recursive have the same inputs.

(define (tail_fact n) (…))

(define (non_fact_helper n res) (…))

(define (non_tail_fact n) (non_fact_helper n 1))

Page 9: CS 360 Lab 1

Lab 1 Part 3 & 4 �  Range

�  (range (start step end))

�  (define (range m) (…)) �  (range ‘(1 2 10)) =>(1 3 5 7 9)

�  Sequence �  Make use of range and map

�  Extra Credit Binomial �  Lecture 2 Part 1 Slide 13