Monday 31 March 2014

Hard Tests and Faulty Marking Systems

During the test, and after the results came in, it was evident that the test was too hard to be completed in 50 minutes. I also think that counting the second test towards our grades is unfair because in my situation, I found that while I was writing the test, I knew that there was no way I could finish all these questions in the time I was given. Thus, I started panicking during the test, and I became depressed because in my first test, I did extremely well, but now I would not be able to keep up that level of excellence. Therefore, even just knowing that I would not be able to do well really affected me because it brought down my confidence in being able to write the test. Then, ultimately, my raw marks ended up being about a mere 40% while my marks in my first test were perfect. I am really disappointed with the Computer Science staff for having written a test that was almost impossible to do well on. I am also disappointed with the systems that are used to record marks and such for the Computer Science courses as well. I have had multiple problems with my lab marks being uploaded to the system, and my instructor has not been returning my emails for help. Moreover, assignments and exercises take an eternity to be fully marked, and the grades after being marked are faulty as well. For example, I noticed that the total marks for assignment 1 was out of 412 when it should have been out of 400 because the 12 bonus marks should not have been counted towards the final mark.

Tuesday 25 March 2014

Sorting and Efficiency

Through my readings and lecture, I have learned that the time complexity of some common sorting algorithms can be expressed using big-oh, big-omega, and big-theta notation. Big-oh notation is used to denote the longest time that any given function will take. Big-oh of a function is the upper bound of the function. For example, the worst case runtime for selection sort can be expressed as O(n^2), which means that as the size of input, n, grows, the runtime for selection sort grows by Cn^2, where C is an arbitrary constant. Big-omega of a function is the lower bound of a function. That means that big-omega of a function is the least amount of time that a function will take to run with a given input. Big-theta of a function is the tight bound of a function. That means that big-theta of a function is the upper and lower bound of the function, and that certain constants will make the function of big-theta such that the function is between the runtimes of big-theta. Moreover, the time complexity of selection sort is O(n^2) because the algorithm will go through each and every single element of a list no matter what order the elements are in, and the algorithm will compare each element to all the other unsorted elements. Thus, this sorting algorithm is of O(n^2) because every element will always be compared to every unsorted element, and as the size of the list grows, there will be a lot more comparisons to be made for each iteration of sorting one element.

Sunday 23 March 2014

Private Functions and Helper Functions

I understand that helper functions are in a sense private functions. However, I am not sure I completely understand the purpose of a private function or a function inside of a function. Why does Python and other languages allow us to write functions inside of other functions? Why does Python not just make us write these helper functions at the same indentation level as regular functions? Then, if there were ever a case that the helper function would become needed, it could be more easily accessible than helper functions that are functions in other functions. I will google more about this topic or consult Mr. Heap during his office hours to clear up the purpose of functions inside of functions.

Monday 17 March 2014

Quick Sort

In class today, Mr. Heap talked about quick sort. He told us that the run-time of quick sort grows a little faster than linear functions. However, after seeing Mr. Heap demonstrate quick sort with the cards he had on the overhead, I do not understand how quick sort is quicker than selection sort. Both sorting techniques look almost the same to me. I hope Mr. Heap will talk more about quick sort in our lecture on Wednesday to clear my doubts about quick sort, but in the mean time, I will google quick sort, and hopefully, I will be able to find out more about what confuses me about quick sort.

Monday 10 March 2014

Intepretation of Concepts

This week after working on A2 Part I, I learned that there are many different ways of interpreting concepts and implementing them. For example, to find the greatest number in a flat list, one can implement a recursive function to determine this number by comparing the two numbers in a list and keeping the larger one until the list has a length that is less than 2 (then you just return the remaining number), or one can use a loop to go through the whole list and keep track of the biggest number. There are many ways of doing exactly the same thing. With A2 Part I, the information sheet had a large portion of it that explained matching strings with regular expressions. I thought that the __eq__ methods that we were supposed to implement were supposed to compare regular expressions to strings because match is a word that is very similar to compare, and the instructions for A2 Part I state that, "Each class should implement or inherit an __eq__ method so that it can be compared to other objects." Thus, I thought that my job was to write an __eq__ method that would compare a regular expression to a string, and that is what I made my __eq__ method do. However, once the instructor version of the classes were released, I realized that Mr. Heap intended to compare regular expressions with other regular expressions with his __eq__ method. All in all, I learned that there are many ways of interpreting things, and I hope that Mr. Heap will accept my code as a reasonable implementation to the __eq__ method, and I will try to arrange a meeting with him to clear up my uncertainty.

Monday 3 March 2014

My Understanding of Assignments

I really dislike reading instructions that are ambiguous yet try to be informative at the same time. For A1, I ended up creating recursive solutions for how to move the cheeses from stool A to stool B without looking at the example and hint given. I am more accustomed to the problems being more clear-cut or ambiguous, not a mixture of both. I find that the examples and hints that we are usually given for exercises and assignments are too ambiguous too really help me in my thought process, or the examples are hinting at something that would not really help me in my process of solving the given problem.

Monday 24 February 2014

Recursion

Recursion is the break-down of a problem into smaller, simpler, similar problems. Then, with those smaller, simpler, similar problems, you derive base cases to solve those problems and then you tie all the solutions to those problems together, and that becomes the solution to the original problem. Recursion is really useful because it can make a large, complicated problem much simpler. Recursion can make a large, complicated problem much simpler because once you break-down the larger problem, the smaller, similar problems are easier to understand and work with. Programmers would choose to use recursion when they have a problem that involves repetitive steps to solve the problem. In other words, recursion can be used when a given problem can be broken down into smaller problems that require the same method to solve them. For example, we took up many recursive function examples in class, such as the the maximum number in a nested list. In the maximum number in a nested list example, we found the maximum number in each flat list of the nested list, then we used those numbers to represent the flat lists until the original list became a flat list in a sense, then the maximum number of the original list would be the maximum number of that flat list. Thus, the maximum number of a nested list example was solved by recursion by breaking down the nested list into many flat lists, finding the maximum number of each flat list, using that number to represent its respective flat list, then the solution would be the maximum number of the final flat list.