Lecture 30: How long does it take?
This assignment is due on Tuesday, December 10 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 similar material together in class.
Exercise 4. Start with the function quick-sort developed in Lecture 24: Quick sort. Fuse its two stages build-pivot-tree and flatten, to get rid of the intermediate PivotTree.
Optional: Read Intermezzo 5 of the textbook.
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. Your tips will be more useful if you explain the reasoning behind them.
(It’s totally fine if your advice makes sense only for some students, not for all students. For instance, feel free to write in any language, or refer to other life experiences.)