Week 10

Continuing formal languages, we looked at equivalent regular expressions and then finite state automata. Again, I've looked at finite state machines before while studying regular expressions last year so what Prof. Heap was describing in class was very straightforward. The only new part would be describing and essentially "drawing" the machine in words. Once it's explained, it's pretty easy to write out and understand though. I find it the easiest to draw first and then put it into words and definitions. I wonder how we're going prove that these DFSA's actually represent the regular expression?

Week 9

So I finally decided to try printing out slides for once, and as expected, it beats copying down notes by a landslide. 


Anyway, we started looking at formal languages this week. I've worked with regular expressions before, so I had no trouble understanding a lot of it. But the way we're approaching it is definitely much more formal than I've ever seen. Other than that, I think this is a nice change from what we've been doing before, even though we're still using induction. Maybe it's just me, but I find this material easier to digest than some previous material we've looked at.

Term Test 2...

Midterms always turn out to be better than I had thought. Maybe with the exception of Stats...


Anyway, this term test went pretty well, I guess (for the amount of studying I had done). I'm pretty sure I got 2 out of the 3 questions perfect. I had some trouble with the question about proving the termination of a loop. Again, what stumped me was the loop invariant (which I wasn't sure that we even needed). I came up with ni = (ni-1+3) / 5, but I had some trouble proving it. Then I got stuck in proving that if there were i+1 iterations, the loop would terminate. I needed to show that ni+1 < ni somehow, but again, the algebra just didn't click for me because I was starting to panic and run out of time. Oh well, this proves that I need to review iterative correctness some more. 

As I was studying for this term test actually, I found the course notes really difficult to read and ultimately, understand. Although the problems done by Prof. Heap are similar, I find his notes much easier to understand than the notes. The notes just seem to have too many words and seem to go on and on. I ended up reading bits of the course notes and referring to Prof. Heap's notes to understand what they were doing rather than vice versa. Hehe.. Maybe this is just me :P

Week Eight

Iterative program correctness requires a bit more work than recursive correctness. Although a bit trickier, I still prefer this over recurrences and time complexity. The lectures this week were pretty interesting. I am finding myself having trouble determining loop invariants, however. I tried reading the book, and even it says that determining these things just requires practice and thinking. There is no mechanical way of finding it unfortunately :( Also, I am not looking forward to proving iterative correctness on tests. After the double loop example we did in class, I can easily see myself rushing to write out a proof as there are so many steps. Hmm. I can't believe everything we've been doing so far involves induction. I knew we were going to work with induction, but I didn't realize that pretty much our entire course is based on it. 


Anyway, I am still trying to let this material settle in. Some more practice problems with proving loops would be great. I was actually hoping there would be a problem set question dealing with iterative program correctness, but we have a test instead. In fact, I can probably expect an iterative correctness question on the test. Well, I guess it's up to me to force myself to do or at least look at some problems... I seriously need more self-control =_=

I decided to work with a partner for A2. For me personally, I think I should have worked on it alone. Although we discussed together how to approach and do the problems, we ended up finishing 2 problems each to save time. This was a real disadvantage because I didn't get to practice writing up half the problems. A2 went alright in the end. It was pretty much a recap of everything we've done so far. We were stuck on Q1 for the longest time, however. I drew A LOT of ternary trees. Haha.. oh well. We got (most of) it in the end. Because we were focussing on Q1 for so long, we overlooked and didn't check our answers for the rest of the questions, and that's where we lost the rest of our marks.

Week 7

Unfortunately, I missed the Monday lecture with the guest lecturer because I was frantically studying for another midterm. Anyway, we looked at program correctness this week. I think compared to the material we were covering the last couple of weeks, I find this a lot easier to take in and understand. There is something about time complexity that I just despise. Program correctness, on the other hand, feels more straightforward. I just need to follow the code and check if the postcondition is satisfied or not given the precondition. 


Thus, I found the problem set for this week pretty easy. I think problem sets are normally quite easy though. Assignment questions, however, are much harder. I also think weekly problem sets are a great way to force lazy people (like myself) to practice and do problems related to the course material recently taught. It makes me feel less behind than I would've been :P

x_x

It has been a very stressful and busy midterm period. Although it's still not quite over yet for me, I am going to take some time and try to catch up on my slogging.

As I've mentioned before, I missed Week 5's lectures, and I am still having trouble understanding how to deal with closed form expressions. I had no trouble with Problem Set 3, but the notes on developing a closed form expression for the Fibonacci function haven't exactly 'clicked' for me. Perhaps the midterm stress is the cause, but I do have to admit that I haven't really sat down and investigated it thoroughly.

We looked at the complexity of merge-sort and the Mast Theorem last week. I really need to print out the slides and write on them instead. There were many slides of just text last week, and I tried to write them all down. In the end, I had "see slides online" written after trying to copy everything down, and I didn't get to hear anything Prof. Heap said as I was too busy writing. It's probably better that I print the notes, read them before lecture, and then just follow along the lecture. It's so simple, yet I feel that I need to continue writing up my notes since that is how all my notes for this class have been so far. Anyway, we proved that the time complexity of merge-sort was nlogn. We actually took the code and came up with a time complexity of which we proved by building on several smaller proofs. Or.. I think that's what we did. To be honest, I am somewhat lost at the moment in the course. As things die down, I think I will be able to make sense of everything again. Hopefully.

Well, besides catching up on the course, there's also another problem set and assignment due next Monday. I've looked at the problem set, and it should be somewhat similar to what we did in Wednesday's lecture. I'm having a bit of trouble wording what I want to say though. In fact, throughout this course, I seem to have some problems with the way I present anything. I'm going to have to work on that. The assignment.. won't be too bad, I hope.

As I was super busy lately, I've totally neglected my blog for a while. So, I'll pick up where I left off.... week 4!

We started looking at more recursive functions and definitions, and we started discussing some proofs involving them. We were introduced to Fibonacci. I was very surprised by how many different places it shows up. We also had some practice identifying recursive definitions. I thought the third example was very interesting. It was as follows

f(n): 
= 0,  if n = 0
= f(n+1) - 3n2,  if n > 0

During class, I thought that this was not a properly defined recursive function because f(n) always depends on its next element, which we'll never get since it depends on the element after that. I had no idea that it could work until Prof. Heap showed us that it could be rewritten.

We also started looking at time complexity of code again, especially of recursive code. We did some of this in CSC165 last year, but I've almost completely forgotten how to deal with it. It was a bit tough at first trying to calculate complexity.  Since we didn't have time to prove the time complexity of something, I've forgotten how to do that too. I'll need to find time to sit down and try to do a problem.

I missed some class last week, so I'll need to get all the notes and read everything over before I write about week 5. The test, I'll just write about briefly now.

The test on Friday wasn't as bad as I had expected it to be. I had a lot of stuff to do, and I ended up only studying the day before, so I was pretty worried. Then again, as I've said last year, it's hard to study for tests involving proofs. Either you get it, or you don't. Anyway, unfortunately for me, I didn't get to finish the entire test. I realized the answer 30 seconds before time was up. I started scribbling and I actually had part of key step on paper, but I didn't get to finish writing up my proof formally. The lack of practice and studying probably made me think a bit slower than I should have. It was an overall disappointing test, but I'll use it to remind myself to study harder for the next test.

Anyway, I hope everyone had a great Thanksgiving weekend. Let the midterms continue...