I found Prof. Heap a very good lecturer, he talks very clear when explaining whats he doing during the lecture and he also interacted with the other students in the lecture in a positive way.
---
In my first sLog post, I posted a problem solving question I had made up based on what happened in the lecture. I will try and finish it here since I didn't finish it.
Problem:
A: Hey! I haven't seen you since grade 9. How many kids do you have?
B: I have 3 kids and the sum of their ages (rounded down to nearest year) is 28.
A: That doesn't really answer my question.
B: Well, I recently had a one of the kids and - *SOMEONE COUGHS BEHIND YOU*
A: That still doesn't tell me how old they are.
B: Well, the oldest isn't older than the last time I saw you.
A: Okay, I see: their ages are - *your boss calls you*
1. UNDERSTANDING THE PROBLEM
Sum of their ages is 28
Recently had a kid
Oldest isn't older than the last time he saw you
2. DEVISING A PLAN
A person in grade 9 is usually aged 13 or 14 so the oldest is <= 13/14
So there is a restriction on the oldest kid, if the oldest is 10 then the other 2 kids ages sum has to add up to 18 but one of their age cannot be greater than 10.
But if the oldest is aged 9, it won't work because the combined age of the other 2 kids are 19 and one of the kids age would have to be at least greater than 10.
So the oldest kid age has to be restricted in the boundary of [10, 14] and depending on the age the other 2 is also restricted.
if oldest = 10 than the ages of the other 2 kids are [0, 10]
if oldest = 11 than the ages of the other 2 kids are [0, 11]
if oldest = 12 than the ages of the other 2 kids are [0, 12]
if oldest = 13 than the ages of the other 2 kids are [0, 13]
if oldest = 13 than the ages of the other 2 kids are [0, 14]
3. CARRYING OUT THE PLAN
So the solution is that the oldest kid has to be somewhere between the ages of 10 to 14 and the second oldest is less than or equal to the age of the oldest and the other kid is the difference of the ages---
Here is my python code for the paper folding problem that Prof. Heap showed us in class.
I realized that a noticeable pattern was that every time you fold the paper. The center would always have a down fold and everything to the left of the centre would be the reverse and the opposite of the right side.
This code returns a list with the resultant folds given the num_folds.
Down folds are 'v' and Up folds are '^'.
def paper_folds(num_folds):
return _paper_folds(num_folds, [])
def _paper_folds(num_folds, folds):
output = folds
for x in range(num_folds):
output = _new_folds(output) + ['v'] + output
return output
def _new_folds(folds):
l = folds[:]
l.reverse()
output = []
for x in l:
if x == 'v':
output.append('^')
else:
output.append('v')
return output