Week 8 was an intense week for me, I had CSC165 assignment due on the 3rd of November, CSC165 term test on the 4th of November, CSC108 assignment due on the 4th of November and a MAT137 problem set due on the 3rd of November. So I was pretty much going crazy this week. In the week 8 lecture we started with the formal definition of O(n^2). Then we analysed a sort algorithm, we went through the insertion sort and Professor Larry showed us an animation of how the insertion sort works. We analysed another algorithm known as the maximum slice which is said to be very useful for stockbrokers. In the last hour of the lecture we had a problem solving session called penny piles. The problem said:
You are sitting in front of two drawers. The left drawer contains 64 pennies, the right drawer contains
nothing. Can you arrange things so that one of the drawers has exactly 48 pennies, using only the following
two operations?
L: If the left drawer has an even number of pennies, transfer half of them to the right drawer (if the left
drawer has an odd number of pennies, operation L is disallowed).
R: If the right drawer has an even number of pennies, transfer half of them to the left drawer (if the right
drawer has an odd number of pennies, operation R is disallowed).
What about arranging things so that one of the drawers contains other numbers in the range [0, 64]? What
about starting with a different number of pennies in the left drawer?
You are sitting in front of two drawers. The left drawer contains 64 pennies, the right drawer contains
nothing. Can you arrange things so that one of the drawers has exactly 48 pennies, using only the following
two operations?
L: If the left drawer has an even number of pennies, transfer half of them to the right drawer (if the left
drawer has an odd number of pennies, operation L is disallowed).
R: If the right drawer has an even number of pennies, transfer half of them to the left drawer (if the right
drawer has an odd number of pennies, operation R is disallowed).
What about arranging things so that one of the drawers contains other numbers in the range [0, 64]? What
about starting with a different number of pennies in the left drawer?
I did it with two of my friends and we pretty much figured out the problem, this session wasn't that hard. I found it quite easy. Today assignment 2 was due. We have the solutions for it already. Now we have a lecture tomorrow and a term test as well. I hope I do well in this one.