Monday 20 July
- Questions about project
- Questions about any outstanding homework/labs
- Questions about Stacks/Queues
- Questions about ArrayLists
- Especially growing array lists and why it can be amortized to
O(1)
- Especially growing array lists and why it can be amortized to
- Questions about lower bound on sorting
Final exam
- Monday 1 August
- Practice exam soon
- “Lab Exam” Wednesday 29th
-
Practice Lab Exam soon
- Remember RIT surveys for extra credit
Bucket Sort
- Suppose I give you an array of numbers. Each number is in the range
[1,5]
. Which algorithm would you use to sort this array - Suppose I give you a huge bucket of balls. Each ball is one of five colors (red, green, blue, yellow, orange) and I ask you to sort them. How would you sort them?
- Describe the bucket sort.
- What is the running time of a bucket sort?
- Why does this not conflict with the
n log n
lower bound discussed in last week’s video? - When would a bucket sort work for integers? When would it not work?
- When would a bucket sort work for things that are not integers?
Radix sort
- We can generalize the bucket sort to be a radix sort.
- If the thing you are sorting has multiple parts, you can apply the bucket sort multiple times.
- Walk through example in the book.
- What is the running time of this approach?
- When will it work? When won’t it work?