This week we finished up on run time analysis and looked at some miscellaneous stuff not covered before. Class ended on Wednesday.
Finished assignment 3, which was surprisingly short, almost gave me the feeling that I missed something very important, hopefully that's not the case.
I suppose I should write a conclusion for the course and slog.
Regarding the course:
Because of the strike, the course is messed up a little bit--no lectures are affected, but we missed 4 labs (still have the lab handouts though), assignment 2 isn't graded yet, and I never got any clear feedback for slog, but that shouldn't directly affect the learning part.
This course feels much less "I'm in the wrong class" than 108 or 165, where most of the material is pretty trivial, though most would probably feel the same. I suppose I learned more than a little bit about the main topics covered. During Christmas break the 108 material and some extra reading helped me to make a thing related to cryptography, and this course helped me to simplify the code greatly when looking back on it last week, which is nice.
Judging by my already crowded course selection plan I'll probably not take many csc courses in the near future, so this will probably be the last csc course I take for a long time, and obviously I still have a long way to go on self-study, I don't know what I should comment about that.
Regarding the slog:
To be honest, I disliked the idea of a slog because of 165, and still do even though being forced to write about what we learned does have benefits, writing this for the weeks where we didn't do much feels like torture. Ended up being rather tired about the whole thing and sadly didn't even insert many of my unfunny jokes. Naturally (though probably not excusably) I'm constantly late for the weekly deadline--sorry.
Then again, as I said writing about the course materials does enhance our understanding a bit, which is, I suppose, the main point of this thing, so there's that.
We are supposed to give feedback to others' slogs, well I did, but not much, since commenting "good work keep up!" is useless, and it's rather hard to find slogs I can provide actual information / insight into. Probably because I don't feel my words are important enough to bother others with, probably I actually don't have much to contribute about... anything.
I mainly read, and saw some interesting things as I did in 165. The majority still stopped doing the slog some time during the term, often either after the first or second post or after reading week, although not so many people dropped the course according to ROSI, so the only explanation is that they stopped caring about this thing.
Not as many slogs that stand out as I found last time, a lot of people--perhaps more than that in 165--are very serious and wrote walls of text each and every post, but nothing particularly different, though I didn't read every single slog so I probably missed all the interesting ones.
Again never got any visitor, this time not even TAs comment here, I'm lonely.
Monday, 6 April 2015
Wednesday, 1 April 2015
Week 12, 0323-0329
Another week, talked about run time analysis which was covered in 108 and 165, but this time from a more... computer sciency angle? Less focus on proofs than 165, where big-Oh seems more like an excuse for people to practice doing proofs, and went deeper than we did in 108--had actual examples of algorithms with run time O(log n), which wasn't seen in 108 because we didn't have the knowledge for the concepts (say, recursion) behind such algorithms. Sadly we didn't have an example of bogosort, I liked bogosort.
Still no labs, strike ended on Friday though so we'll be back to normal next week--last week of class. Okay.
We're supposed to revisit a previous slog this week, but since I really didn't write much about my opinions--because I don't have many opinions regarding the class material--I don't have much to disagree about with my previous self. There are indeed some issues with my first few posts though, where I didn't particularly write a lot because, well, I kind of hated the idea of another slog to maintain after 165. Then again, I did have enough to write about in 165, so could be I wasn't quite familiar with the materials yet to explain them clearly this time, which is shown by the less-than-ideal test 1 / assignment 1 marks, even though I assumed they were intuitive (which turns out to be the case, but I did miss something at first). I don't think I quite understood how classes work until assignment 2, when we were given some kind of starter to work on instead of nothing, the latter which for me developed into, in retrospect, a tangled mess.
Judging by the few slogs I saw that are still active I'm not alone in thinking that time has, perhaps in a rather subtle manner, enhanced our understanding about ideas, though then again, when we generalize to that, it doesn't mean much anymore. Many seem to have trouble understanding recursion at first, which is interesting to me as I actually found the material straightforward, could be because I'm in math, but one wouldn't know.
Still no labs, strike ended on Friday though so we'll be back to normal next week--last week of class. Okay.
We're supposed to revisit a previous slog this week, but since I really didn't write much about my opinions--because I don't have many opinions regarding the class material--I don't have much to disagree about with my previous self. There are indeed some issues with my first few posts though, where I didn't particularly write a lot because, well, I kind of hated the idea of another slog to maintain after 165. Then again, I did have enough to write about in 165, so could be I wasn't quite familiar with the materials yet to explain them clearly this time, which is shown by the less-than-ideal test 1 / assignment 1 marks, even though I assumed they were intuitive (which turns out to be the case, but I did miss something at first). I don't think I quite understood how classes work until assignment 2, when we were given some kind of starter to work on instead of nothing, the latter which for me developed into, in retrospect, a tangled mess.
Judging by the few slogs I saw that are still active I'm not alone in thinking that time has, perhaps in a rather subtle manner, enhanced our understanding about ideas, though then again, when we generalize to that, it doesn't mean much anymore. Many seem to have trouble understanding recursion at first, which is interesting to me as I actually found the material straightforward, could be because I'm in math, but one wouldn't know.
Tuesday, 24 March 2015
Week 11, 0316-0322
Looks like my count of week number differs from the course website's as I counted reading week in. Shouldn't be too much trouble to figure out though.
This week we looked at assertion and testing a bit. Nothing seems particularly counterintuitive, the materials left to be covered are more of small bits here and there after all.
Assignment 3 is posted. I think I prefer option B, likely because ideas explored in option B seems to form the basis of those in option A. As of now it's going alright, I'll try not to land myself into an "find a problem near the deadline, panic and submit 5 minutes before the deadline" scenario again...
This week we looked at assertion and testing a bit. Nothing seems particularly counterintuitive, the materials left to be covered are more of small bits here and there after all.
Assignment 3 is posted. I think I prefer option B, likely because ideas explored in option B seems to form the basis of those in option A. As of now it's going alright, I'll try not to land myself into an "find a problem near the deadline, panic and submit 5 minutes before the deadline" scenario again...
Tuesday, 17 March 2015
Week 10, 0309-0315
Strike is still going on, labs are still cancelled, not much to write about.
We had a midterm this week, so there's only one lecture further into binary trees. The lecture was mostly about implementation of insert and delete on binary trees, which are slightly messier than the methods we've seen before, especially the delete one which has a whole lot of cases.
The midterm went fine, although I may or may not forgot to write one of the cases for the last problem. My memory is faded.
We had a midterm this week, so there's only one lecture further into binary trees. The lecture was mostly about implementation of insert and delete on binary trees, which are slightly messier than the methods we've seen before, especially the delete one which has a whole lot of cases.
The midterm went fine, although I may or may not forgot to write one of the cases for the last problem. My memory is faded.
Monday, 9 March 2015
Week 9, 0302-0308
This week was uneventful other than that labs were cancelled because of the strike. We finished up on assignment 2 and talked a bit about iteration, but didn't cover much.
I thought I finished assignment 2 early, but realized around an hour before it's due that the minimax strategy doesn't work properly. Again cue frantic revising. Beating the deadline by five minutes was a bit too thrilling for my likings, but I suppose it worked out fine this time.
Iteration is somewhat similar to recursion in that it also repeats a part of a task until the task itself is done, although iteration is more of repeating a smaller (parallel) portion of a task until the loop condition fails, while recursion reduces the task into simpler and simpler cases until the base case is reached. We used linked lists as an example for iteration, where objects (nodes) in the list are linked to one another, so iteration works well here. We define a "front" node and move along the list, changing our current node, to achieve whatever we want to do, say check if an object is contained in the list.
I've been reading some of the other slogs, but don't really have much to say other than occasionally giving solutions to problems. Not sure how to work on that part.
I thought I finished assignment 2 early, but realized around an hour before it's due that the minimax strategy doesn't work properly. Again cue frantic revising. Beating the deadline by five minutes was a bit too thrilling for my likings, but I suppose it worked out fine this time.
Iteration is somewhat similar to recursion in that it also repeats a part of a task until the task itself is done, although iteration is more of repeating a smaller (parallel) portion of a task until the loop condition fails, while recursion reduces the task into simpler and simpler cases until the base case is reached. We used linked lists as an example for iteration, where objects (nodes) in the list are linked to one another, so iteration works well here. We define a "front" node and move along the list, changing our current node, to achieve whatever we want to do, say check if an object is contained in the list.
I've been reading some of the other slogs, but don't really have much to say other than occasionally giving solutions to problems. Not sure how to work on that part.
Monday, 2 March 2015
Week 8, 0223-0301
Reading week is over and we are back to class.
We talked about binary trees this week, which is basically a special type of tree which has at most two children. As such it'd be inefficient to organize the children of binary tree nodes into lists, and using two attributes for the "left child" and the "right child" for each node seems like a good idea.
Binary trees, with their special property, seem useful for representing and evaluating binary expressions, as we can describe them using such trees with each leaf as a value to be operated upon, and two leaves' common parent as the operator to perform on the left and right leaves. This way, by recursively going down the tree, joining the operators and values, we would be able to easily obtain the multilayer binary expression represented by the tree and evaluate it.
This concept is also helpful for searching for values, as an ordered binary tree (where the left child of a node is always less than the value of the node itself which is in turns less than the right child of the node) can direct the search to one path, so that we don't have to examine the nodes that are, by the orderedness of the tree, clearly not the value we are looking for. This means we can halve the search scope every step we go down the tree, so it takes at most lg n steps to search a tree with n nodes (meaning the worst case performance is O(lg n)), which seems much more efficient than a linear search where the worst case performance is O(n) steps.
Assignment 2 is going okay. I finished the tippy game and am working on minimax. I've found myself scrapping all my work and restarting more than once during this assignment though. I'm not sure if that's a good sign or not.
We are supposed to give a summary for recursion, object-oriented programming, or abstract data types for this week. I've already done the first two, but I think I'll add a few more words to the recursion one, as it seems that the TA didn't like it--I'm honestly not sure what the TA is looking for though. I'll just give a general summary of how it works.
What we've been working on for recursion is basically defining the function's behavior on a base case where everything else can be reduced to such a case, and by calling the function itself within the code for the function, reduce other more complicated cases to the base case. I once heard someone saying recursion can be explained as "an onion is an onion skin with an onion inside". We don't particularly care about how many layers of skin the onion has (well, as long as it's finite), as recursion does the work for us, we only need to define exactly how the function peels the onion skin, how the function operates on the core of the onion, and how the function reconstruct the layers of onion skin back into an onion, or into whatever we want it to be.
For example, a function f that operates on objects in lists can be applied to objects in nested lists using something as shown below:
def g(l):
if isinstance(l, list): # when the object operated upon is a list
return [g(i) for i in l] # reduce to a list of one less layer
else: # base case
return f(i) # f is the function directly applied onto the objects in the list
Here, the function g is an application of recursion, which reduces nested lists to nested lists with less layers and eventually to non-list objects which it passes to f. The reconstruction of the onion here is just putting the onion skins (list brackets) back up. So the outcome is the original list with each non-list object in it being operated upon by f.
We can do something else with the reduced case though, say if we change g into:
def g(l):
if isinstance(l, list):
return max([g(i) for i in l])
else:
return f(i)
the outcome would be the maximum value of the function f applied to each non-list objects in the list. Of course, here f has to be some function that outputs a string or a numerical value.
I've talked about applications of recursion, and as the binary tree example discussed above is also an case of the applications of recursion, I suppose there's no need to restate how useful it is.
We talked about binary trees this week, which is basically a special type of tree which has at most two children. As such it'd be inefficient to organize the children of binary tree nodes into lists, and using two attributes for the "left child" and the "right child" for each node seems like a good idea.
Binary trees, with their special property, seem useful for representing and evaluating binary expressions, as we can describe them using such trees with each leaf as a value to be operated upon, and two leaves' common parent as the operator to perform on the left and right leaves. This way, by recursively going down the tree, joining the operators and values, we would be able to easily obtain the multilayer binary expression represented by the tree and evaluate it.
This concept is also helpful for searching for values, as an ordered binary tree (where the left child of a node is always less than the value of the node itself which is in turns less than the right child of the node) can direct the search to one path, so that we don't have to examine the nodes that are, by the orderedness of the tree, clearly not the value we are looking for. This means we can halve the search scope every step we go down the tree, so it takes at most lg n steps to search a tree with n nodes (meaning the worst case performance is O(lg n)), which seems much more efficient than a linear search where the worst case performance is O(n) steps.
Assignment 2 is going okay. I finished the tippy game and am working on minimax. I've found myself scrapping all my work and restarting more than once during this assignment though. I'm not sure if that's a good sign or not.
We are supposed to give a summary for recursion, object-oriented programming, or abstract data types for this week. I've already done the first two, but I think I'll add a few more words to the recursion one, as it seems that the TA didn't like it--I'm honestly not sure what the TA is looking for though. I'll just give a general summary of how it works.
What we've been working on for recursion is basically defining the function's behavior on a base case where everything else can be reduced to such a case, and by calling the function itself within the code for the function, reduce other more complicated cases to the base case. I once heard someone saying recursion can be explained as "an onion is an onion skin with an onion inside". We don't particularly care about how many layers of skin the onion has (well, as long as it's finite), as recursion does the work for us, we only need to define exactly how the function peels the onion skin, how the function operates on the core of the onion, and how the function reconstruct the layers of onion skin back into an onion, or into whatever we want it to be.
For example, a function f that operates on objects in lists can be applied to objects in nested lists using something as shown below:
def g(l):
if isinstance(l, list): # when the object operated upon is a list
return [g(i) for i in l] # reduce to a list of one less layer
else: # base case
return f(i) # f is the function directly applied onto the objects in the list
Here, the function g is an application of recursion, which reduces nested lists to nested lists with less layers and eventually to non-list objects which it passes to f. The reconstruction of the onion here is just putting the onion skins (list brackets) back up. So the outcome is the original list with each non-list object in it being operated upon by f.
We can do something else with the reduced case though, say if we change g into:
def g(l):
if isinstance(l, list):
return max([g(i) for i in l])
else:
return f(i)
the outcome would be the maximum value of the function f applied to each non-list objects in the list. Of course, here f has to be some function that outputs a string or a numerical value.
I've talked about applications of recursion, and as the binary tree example discussed above is also an case of the applications of recursion, I suppose there's no need to restate how useful it is.
Sunday, 22 February 2015
Week 6, 0209-0215
This week we got our test and SLOG marks back. The test went okay, although not exactly great--I corrected one of my answers into a wrong one before handing it in thinking it's a better way to answer the problem, which doesn't end up being a smart move.
The mark I received for the SLOG is also pretty bad. I'm starting to get confused about the whole rubric for SLOG, so I'd appreciate it if the TA who marked my SLOG would give me a bit more feedback than "be more consistent" and "put more insight into problems or concepts encountered in the course" as that is pretty vague.
We've been learning about trees, which is another type of object based on queues that exists and becomes useful thanks to the idea of recursion. Assignment 2 is also posted.
We are supposed to talk about object-oriented programming this week.
During the first few weeks of this course, we investigated deeper into classes, which is python's version of object-oriented programming.
The concept of classes lets us define types of objects with whatever attributes we want them to have. Obviously this simplifies our code for programs, as functionally similar objects can be grouped into the same class which allows for reuse of code, and it's much easier to work with a class of objects defined as "dictionary with keys as strings and corresponding values as tuples of strings and lists and integers" than to define the abomination as such every time one encounters it. This also allows for simultaneously having multiple objects of a class, called instances of the class, and operating upon them using the same functions or methods.
Methods act like general functions that we've worked with in CSC108, but are defined within a specific class and operates on objects of the class. It can directly access the attributes of an object and work on such, but is otherwise pretty similar to general functions. The introduction of classes also expands the scope of the latter though, as classes of objects can be passed as parameters of functions, so functions can define interaction between objects of different classes.
Inheritance further classfies objects into subclasses of classes (so should subclasses be called orders or should superclasses be called phyla?). The objects in subclasses have some common attributes and methods covered in the superclass, and each subclass provides more detailed attributes and methods--often partially inherited from the superclass by declaring such--for the objects. Inheritance enables more reuse of code, as functionally similar types of classes of objects can also be grouped together and operated upon using the same code, only slightly changed in the specification for each subclass.
Right now the idea of classes feels mostly like an organization technique, as it organizes objects into classes and subclasses, and allows functions to be defined on the group of objects instead of individual objects themselves. As pointed out repeatedly, it greatly simplifies code, and allows for things that's difficult (or perhaps impossible) to be done with what we've learned before, so I suppose it's quite useful. We'll see what it can do.
The mark I received for the SLOG is also pretty bad. I'm starting to get confused about the whole rubric for SLOG, so I'd appreciate it if the TA who marked my SLOG would give me a bit more feedback than "be more consistent" and "put more insight into problems or concepts encountered in the course" as that is pretty vague.
We've been learning about trees, which is another type of object based on queues that exists and becomes useful thanks to the idea of recursion. Assignment 2 is also posted.
We are supposed to talk about object-oriented programming this week.
During the first few weeks of this course, we investigated deeper into classes, which is python's version of object-oriented programming.
The concept of classes lets us define types of objects with whatever attributes we want them to have. Obviously this simplifies our code for programs, as functionally similar objects can be grouped into the same class which allows for reuse of code, and it's much easier to work with a class of objects defined as "dictionary with keys as strings and corresponding values as tuples of strings and lists and integers" than to define the abomination as such every time one encounters it. This also allows for simultaneously having multiple objects of a class, called instances of the class, and operating upon them using the same functions or methods.
Methods act like general functions that we've worked with in CSC108, but are defined within a specific class and operates on objects of the class. It can directly access the attributes of an object and work on such, but is otherwise pretty similar to general functions. The introduction of classes also expands the scope of the latter though, as classes of objects can be passed as parameters of functions, so functions can define interaction between objects of different classes.
Inheritance further classfies objects into subclasses of classes (so should subclasses be called orders or should superclasses be called phyla?). The objects in subclasses have some common attributes and methods covered in the superclass, and each subclass provides more detailed attributes and methods--often partially inherited from the superclass by declaring such--for the objects. Inheritance enables more reuse of code, as functionally similar types of classes of objects can also be grouped together and operated upon using the same code, only slightly changed in the specification for each subclass.
Right now the idea of classes feels mostly like an organization technique, as it organizes objects into classes and subclasses, and allows functions to be defined on the group of objects instead of individual objects themselves. As pointed out repeatedly, it greatly simplifies code, and allows for things that's difficult (or perhaps impossible) to be done with what we've learned before, so I suppose it's quite useful. We'll see what it can do.
Sunday, 8 February 2015
Week 5, 0202-0208
Because of the midterm we didn't exactly cover much during lecture this week. The midterm went fine, although the marks aren't out yet to determine how we did. Since the SLOG requirement for this week is about tracing recursions, I might as well talk about that.
...I don't really know what to talk about tracing recursions. It's pretty helpful for one to see what exactly the function does and how recursion works, but I suppose that's it. Tracing is rather boring once one understands what's going on, and gets frustrating quickly. So I'll write about recursion in general instead.
Judging by what we've seen so far, recusion is indeed useful as for reducing code complexity for tasks, since it is much simpler than layers of dreaded if-then statements (which might not even work), and for general problems which may or may not be doable (efficiently) with what we've learned in CSC108. Quick sort is the obvious example for the latter motive, with an average performance of O(nlogn), it works much faster than the sorting algorithms we learned before which all has average performance O(n^2).
It seems that we're going to be working on recursion for a while, as both the examples done in lecture--quick sort and the example on checking imbalanced parentheses--are both applications of recursion, and as the SLOG requirements for later weeks are often on recursion. Looks like I'll have to revisit this topic a few times in the future when we learn more about it.
...I don't really know what to talk about tracing recursions. It's pretty helpful for one to see what exactly the function does and how recursion works, but I suppose that's it. Tracing is rather boring once one understands what's going on, and gets frustrating quickly. So I'll write about recursion in general instead.
Judging by what we've seen so far, recusion is indeed useful as for reducing code complexity for tasks, since it is much simpler than layers of dreaded if-then statements (which might not even work), and for general problems which may or may not be doable (efficiently) with what we've learned in CSC108. Quick sort is the obvious example for the latter motive, with an average performance of O(nlogn), it works much faster than the sorting algorithms we learned before which all has average performance O(n^2).
It seems that we're going to be working on recursion for a while, as both the examples done in lecture--quick sort and the example on checking imbalanced parentheses--are both applications of recursion, and as the SLOG requirements for later weeks are often on recursion. Looks like I'll have to revisit this topic a few times in the future when we learn more about it.
Sunday, 1 February 2015
Week 4, 0126-0201
This week we mostly talked about recursion and finished up assignment 1. The material seemed intuitive enough, though I don't know how long it will remain this way.
Overall the first few weeks went okay, I think I know what we were talking about, although I am not entirely sure about that. The lectures are much more engaging than CSC108 (in which we mainly did exercises during lectures) and more similar to the style of lecture in CSC165 (well, because the instructor is the same), which is probably a good thing.
Oh and next week we have our first midterm. Hopefully it will go fine, though it did remind me that I never got my tests for CSC165 back due to shyness, conflicting commitments and crowded office hours, and I put off getting them back until it became awkward to ask for them (not a good idea to ask for test #1 back when everyone is worrying about the final). I suppose that is--personally--a bigger problem than the midterm itself. If only we could get it back during tutorials...
Overall the first few weeks went okay, I think I know what we were talking about, although I am not entirely sure about that. The lectures are much more engaging than CSC108 (in which we mainly did exercises during lectures) and more similar to the style of lecture in CSC165 (well, because the instructor is the same), which is probably a good thing.
Oh and next week we have our first midterm. Hopefully it will go fine, though it did remind me that I never got my tests for CSC165 back due to shyness, conflicting commitments and crowded office hours, and I put off getting them back until it became awkward to ask for them (not a good idea to ask for test #1 back when everyone is worrying about the final). I suppose that is--personally--a bigger problem than the midterm itself. If only we could get it back during tutorials...
Thursday, 22 January 2015
Week 3, 0119-0125
After finishing CSC165, I thought I won't have to touch SLOG ever again, but it turns out CSC148 also requires a SLOG. Well, here we go again.
This week we talked about inheritance and list comprehension. We have been working on assignment 1, which is due next week.
Apparently, this week we are supposed to write on a set topic, namely "Why geeks should write". At least this way I'd have something to write about, instead of struggling to make the post more than three lines since we haven't done much in class yet, so this is probably is a good thing.
I would like to forewarn the readers (if there are any), that I am not exactly good with words, especially with words that directly concern my own opinion: Last semester's SLOG went okay, but I am not sure if I actually know what to write about outside of what happened this week; when trying to write the response to the topic, I keep finding myself drifting into high school persuasive essay mode, which is most probably not what the professor and TAs are looking for. So I will paraphrase what I wrote in my CSC165 SLOG to explain and apologize for a few things about my writing style.
I don't usually have a lot of feelings regarding my courses, especially the introductory ones, so I struggle trying to find something to say. The lecture material should be mostly accessible to everyone anyways, so it feels like a waste of time for the readers to recite everything we covered in lecture. I try to be funny, or at least not sleep-inducing, but my sense of humour is probably non-existent, as I even failed miserably at amusing myself with my deadpan jokes. I try to include personal experiences, but I'm just an extremely boring person.
Geeks, or more generally, STEM majors and enthusiasts, are obviously less involved with actual writing in their work than people in humanities or social sciences. Especially in undergraduate courses, assignments are almost always problem sets and projects, which though still require a certain level of communication skills, do not involve a lot of writing--Of course, we could argue that docstrings require competence in writing and that logic/mathematics is a language, but these arguments, although probably true, would seem rather laughable when being used to increase the tally of writing done.
Still, regardless of field of study, writing is essential for deeper understanding, from higher level courses to later, research. It is easy to understand and master information presented in introductory courses, but as we dive deeper into the subject, the effort required increases, and it becomes infeasible to try to comprehend the material without trying to explain them in natural language--sometimes a perhaps simpler way--and noting down our own thoughts regarding them.
The importance of writing in communication with others is probably what is more emphasized on for this post and for SLOG in general though, since CSC148 is not exactly a high level course and the handout also stressed the need of communication. Again, the importance of this aspect only increases as we go on along the way of doom further studies, since communication greatly enhances understanding and certain (real life) tasks would require collaboration. Unfortunately, we (or at least most of us) are more fluent in English (or any other natural language, for that matter) than in mathematics, logic, or Python, and they all are near impractical in certain situations, so using English to aid our communication seems unescapable. Such a (terrible) fate necessitates the ability to communicate effectively in English, which is probably why I am writing this post now.
EDIT: Seems that I accidentally got the month wrong. Fixed.
EDIT: Seems that I accidentally got the month wrong. Fixed.
Subscribe to:
Posts (Atom)