Lecture 30: How long does it take?
This assignment is due on Tuesday, December 6 at 11:59pm. Submit it using Handin as assignment lecture30. You only need to submit the first 3 exercises.
- Calculate step-by-step
- Calculate step-by-step
- Calculate step-by-step
How many servings of steps does it take to add to the end of a 2-element list? Define this number as a constant named add-to-end-2
How many servings of steps does it take to add to the end of a 3-element list? Define this number as a constant named add-to-end-3
How many servings of steps does it take to add to the end of a 4-element list? Define this number as a constant named add-to-end-4
How many servings of steps does it take to reverse a 3-element list? Define this number as a constant named rev-3
How many servings of steps does it take to reverse a 4-element list? Define this number as a constant named rev-4
How many servings of steps does it take to reverse a 5-element list? Define this number as a constant named rev-5
For the rest of this page, you don’t need to submit anything, but do watch the videos and try the exercises anyway. We’ll work through the material together in class.
Exercise 4. Start with the function quick-sort developed in Lecture 23: Quick sort. Fuse its two stages build-pivot-tree and flatten, to get rid of the intermediate PivotTree.
Exercise 5. Any advice for future students? Think back to 3 months ago when you were just starting the course. What would have helped you then? Please share your wisdom as comments, and we will pass it on to the next generation.
Optional: Read Intermezzo 5 of the textbook.