Sunday, 31 March 2013

SLOG 9

My first year of university is almost over! There is only one more week to go until exams. I'm going to need to motivate myself and work hard for the next month.

I did not do well on the quiz last week because I wasn't putting enough effort into learning the material. However, the assignment so far isn't that bad. I'm finding that proving the big-Oh or Omega of a polynomial isn't that hard. I'm still confused with the material related to the halting and reductions and I'm not sure how I'm going to do on the quiz this week. I've lost so many potential "easy" marks due to the quizzes, but the good thing is that I learn from my mistakes right after.

All in all, this course wasn't boring, but it wasn't that enjoyable either. I've learned many new things in this course that will help me in the future. I hope all my exams goes well!

Sunday, 24 March 2013

SLOG 8

The material that was covered this week was alright. The proofs for finding whether some function is in the big O of another function seemed straight forward. It actually took me a while to understand big O or Omega because of my lack of focus during lectures. It doesn't seem that hard when professor Heap is doing the proofs, but when it comes down to me doing the proof it might feel different and possibly confusing. I wasn't quite sure how I did on the quiz this week. I'm hoping for a 2/2 since I haven't got that in a while. As well, I was quite satisfied with my test mark and my assignment mark. I just need to ace the next two quizzes to make up for my poorly done quizzes.

For my mathematical problem, I have written some python code to solve this. So the way I thought of this was to make a while loop inside a for loop. And this would generate a whole bunch of lists. Each list would contain only one element from L and so when the while loop executes it will append values to the list that are greater than the previously appended value. Afterwards, I made a for loop that would find the list with the longest length and that list would be the greatest non-decreasing sub-sequence. Something I could change is if there are multiple lists with the same length. I guess I could take the list with the greatest length and greatest sum.

So here is my code to solving the greatest non-decreasing sub-sequence:

def longest(L):
    size = 0
    _list = []
    list_all = []

    for x in range(len(L)):
        _list.append(L[x])
        temp = L[x]
        ind = x

        while ind + 1 != len(L):
            if L[ind + 1] > temp:
                temp = L[ind + 1]
                _list.append(L[ind + 1])
            ind += 1

        list_all.append(_list)
        _list = []

    for i in list_all:
        if size < len(i):
            size = len(i)
            long = i

    return long

Sunday, 17 March 2013

SLOG 7

The second test did not go so well for me. The first two questions were fairly simple and straight forward and I'm confident that I got both of them, but I was unable to complete the last question relating to proofing something using the floor of x. I should have wrote down the ceil example from the lectures onto my cheat sheet. Not completing the third question completely is really going to impact this test mark. I will need to review and learn from my mistakes.

The problem that I'm exploring can be viewed here.

So basically according to G. Polya, How to Solve It, the first step is to understand the problem. The conditions of this problem are that all the numbers in the list are integers and that the list is unsorted. With that information I'm supposed to find some non-decreasing sub-sequence of the list. So to solve this problem I would need to figure out some algorithm to complete this task. This problem would be quite easy to do in person if the list was really small, but if the size of the list is like 100 then it would be a different story. For example, [4, 10, 20, 5] the largest non-decreasing sub-sequence is 4, 10, 20. However, if the list is [5, 2, 3, 6, 20, 15, 4, 9 , 7, 40, 23, 44, 51, 11, 23, 33, 101, 1, 58, 9, 2] then a lot of comparing of numbers would be required.

So next week I'll be showing my approaches and algorithms on solving this task.

Sunday, 10 March 2013

SLOG 6

It's been quite some time since I've wrote a slog entry. I've been quite lazy and I've been slacking a whole lot. I'm not doing as well as I want to on the quizzes and also in some other courses that I'm taking. I'm going to need to work harder in this course as well as my other courses to make up for my mistakes. Assignment 2 is finally complete and test 2 is coming up this week. It sucks that I have a test everyday for 3 days again.

I'm not excited for this test since proofs don't really amaze me and I don't enjoy doing proofs. As well, I don't think that I'm great at doing proofs either. The test will mainly consist of multiple proof questions and so I will need to work harder. I'm also hoping that my mark for this test will be higher than my previous test.

Chapter 4 doesn't seem that interesting, but it does seem very helpful in the future. I'm still kind of confused when professor Heap is talking about the upper bound and lower bound of some function. The reason for this is possibly because of lack of attention during lectures.

The problem that I will be exploring and trying to solve is this problem called Growing Sequences. The link to this problem can be found here: https://wwwcgi.cdf.toronto.edu/~heap/cgi-bin/Solvent/wiki.pl?Problem_Solving_Home_Page/GrowingSequences