Friday 5 April 2013

Final thoughts...

I am writing this at 6 in the morning, not yet having slept because of all of the work that goes into finishing up projects at the end of the semester! Another semester has come to a close, but I felt as though I have learned so much these last few months. I have thoroughly enjoyed CSC165 (some friends of mine in CS told me that it was incredibly difficult and "not fun" -- I beg to differ! It is challenging, but rewarding). There is a steep learning curve in this course, and I can admit that sometimes I was not fully prepared for what was coming (cough cough, assignment 2), but once I spent a few quality hours going through solution after solution, I quickly began to understand that logic isn't so scary after all.

Met some really great people in my tutorial too, I hope to see them in future courses. To anyone who takes this course in the future, and who may stumble across my sLog: do not be afraid to take risks. Logic isn't "black and white", something you can easily memorize. It requires a lot of work, a lot of scribbled down notes, and a lot of trial and error until you can find "your" solution.

Overall, great course. I would definitely take it again! 

Time to problem solve

http://www.cdf.toronto.edu/~heap/165/W13/ProblemSolving/pennyPile.pdf

1. Understand the problem.

There isn't too many conditions with this problem, the problem itself is not too long.
What I know:

  • There are 2 drawers, let's call them L and R.
  • L = 64 (There are 64 pennies inside)
  • R = 0
Is it possible to arrange the drawers of pennies so that there is 48 pennies in one drawer considering the following conditions:
  • If the left drawer has an even number of pennies, I may transfer half of them to the right drawer.
  • If the right drawer has an even number of pennies, I may transfer half of them to the left drawer.
  • If L or R have an odd number of pennies, I am not allowed to do either operation.
2. Devise a plan.

In addition to the problem, Prof. Heap has included some nice "hints" to help begin the problem solving:
  • Work backwards.
  • Use smaller cases.
  • Draw a picture.
For me, I will work with the first hint, I am not sure which drawer will be the one containing the final number of 48 pennies, so it is best to consider both cases at the same time. We will call them Case 1 and Case 2.

Case 1: L has 48 pennies, R has 16 pennies.
Case 2: L has 16 pennies, R has 48 pennies.

3. Carry out the plan.

Case 1
Let's begin by working backwards:
L:48 -> L: 64
R:16 -> R: 0

Time to fill in what goes between "->"
L: 48 #I know that I am able to only move pennies when L/R are even.
R:16 #Both L/R are even, so let's move 16 pennies from L to R.

L: 32 #Interesting.. they are still both even, and they are now equal.
R: 32 #Let's move 32 from R to L.

L: 64 #We have completed the task this in 3 steps.
R: 0

Case 2
L: 16 -> L: 0
R: 48 -> R: 64

Time to fill in what goes between "->"
L: 16 #Let's move 16 from R to L.
R: 48

L: 32 #Let's move 32 from L to R.
R: 32

L: 0
R: 64 #We are done.

4. Look back, reconsider the problem. What were some things I have to overcome?

While this problem was not extremely complicated, it could become more difficult had one the numbers become odd, and I were restricted to moving only one drawer. For me, the most difficult part was thinking ahead. This is one of the tough things I encountered when learning proof structure. It can be difficult to think in terms of "one step ahead". Think of a Big-O or Big-Omega proof - you know what you start with, and what you want to end with, but you have to somehow think about how they will meet in the middle - thinking one step ahead.
One of the critical steps in this problem was knowing that if there is 48 in one drawer, there must be 16 in the other. From here, it was not too difficult to decide which way the pennies were meant to move. :)

Tuesday 2 April 2013

A solution to the blue eyes problem

http://xkcd.com/solution.html

A (long, but precise) explanation of the solution to the "hardest logic puzzle in the world". A very interesting problem with an answer that may not sound complicated, but actually sounds like it would take a lot of time to wrap your head around! I know it took me a few times to read through the solution to fully understand. That is the fun part about logic, sometimes it makes too much sense! :)

Coming up on the end of the term, I want to make an update on some of the things I have been working on/feeling:

  • I really struggled on Assignment 2. I didn't fully understand how to complete a proof, I have only done proofs a few times outside of this class, but I found that those proofs were much more obvious/algebraic than the one's we are using in this class. I paid the cost with my grade for that assignment.
  • Somehow, I turned it around on the midterm. Well, not really somehow, but I remember going through practice problems from previous midterms. My boyfriend was helping me go through them and break them down and help me understand better. He is a computer science specialist in 3rd year, and has a lot more experience working with proofs than I did. He even wrote a few for me himself. 
  • I quickly realized that I had no idea what I was doing when it came to proofs, I was a nervous wreck, it was the night before the exam and I was terrified that I would do poorly (this was before I was aware of my a2 grade, so I was still under the impression that I had a grasp on what I was doing).
  • I spent more of the night doing problems over and over and over again, and then I quickly realized that there is almost a method to doing the proof, like the whole reason we write a proof structure in the first place -- I just could not visually understand it before I wrote my a2. 
  • If I had the chance to redo my a2 assignement, I am guessing I would improve drastically based on my new knowledge of proofs. I hope to prove myself on a3 and improve my grade before heading into the final exam.

Thanks for reading!

Saturday 23 March 2013

The Hardest Logic Puzzle in the World

A friend posted this on their Facebook page, it's quite an interesting problem. Try reading the problem before the answer: I had actually confused myself quite a bit trying to figure out some "algorithm" to solve this problem, when really it is truly, logical.

Source: http://xkcd.com/blue_eyes.html

Wednesday 30 January 2013

Logical Assessment

I have just finished, and submitted, my a1 assignment for CSC165. I am curious to get back my grades as soon as possible, because I want to determine where I can improve for the upcoming midterm, as well as for future reference. I found this assignment to be tricky, but enjoyable. It was not overwhelmingly long, but took me a while to figure out. Here is how I tackled it:

  • Making a plan: I would take a question and try to break it down into smaller steps. I started off by writing the original statement in symbols, which I find easier to visualize than in english. I also had a notepad next to me to jot notes down as I go, as well as the symbolic definitions of negation, contrapositive and converse. I found that doing this was extremely helpful.

  • Executing the plan: I would go step by step, and if I came across something I felt I didn't understand, I would refer to the lecture for that day. I prefer to look at the annotated lectures because the notes Prof. puts on them are helpful for reference. 

  • Don't panic: I found that a few times I felt extremely overwhelmed (particularly on question 3 when trying to convert symbolic to english). I decided that every time I felt this way, I would take a break from the assignment for ~10-15 minutes and then I was able to think more clearly. Actually, doing this helped me to find a few mistakes I was making during the early stages of tackling the problems.
All-in-all, I am excited to have finished this assignment, but now it is time to study for the midterm!

Tuesday 22 January 2013

Week 3 thoughts

Now that week 3's tutorial has been completed, I thought I would post some of my concerns for the next few weeks of class:

  • Keeping up: I feel as though from week 2 to week 3, there has been a huge jump (I will admit, the tutorial exercise this week was significantly more difficult than the first week). I find it sometimes difficult to wrap my brain around some of the symbolism, not so much understanding what each symbol means... but what the question as a whole means.
  • Pushing forward: I sometimes get negative on myself when I feel frustrated about not understanding the question. I think this is what office hours and tutorial were made for. I hope to take advantage of these times so that I can understand concepts more concrete, in preparation for an assignment or midterm. If this course is like any other at U of T, I should know that tutorial quizzes do not reflect the intensity of knowledge that will be on an assignment or midterm. I must strive to push forward so that I am able to keep up with the work, and not have (as many!) frustrating moments.

Tuesday 15 January 2013

MASS CONFUSION

I had my first CSC165 tutorial today. It is a small class and we got to go through all of the exercise in small groups. I enjoy doing small group settings instead of large lectures because I feel like it is easier to ask questions that way. One of the questions that was raised in my class was over Question 2, part b/d:
There is one of the three python programs that passes all three test suites. and There is one of the three python programs that fails all three test suites. My TA, along with several of my classmates interpreted this question as there being at least one of the three python programs that passes/fails all three test suites. I interpreted it as being simply only one program. Because of this confusion, my answers were different from the TA's solutions. Who is right? I am not sure what the proper "correct" answer was, but it was still nice that we were able to debate our points. My TA said that he will ask professor what he believes in the correct interpretation of the problem... so, until next week!