Week 11: Revisiting the Past
This is our final week and I'd like to shift back a bit first to comment on Week 6-9, as I didn't much of an opportunity before. I would also like to revisit some of my earlier thoughts of the course and the material itself.
During reading week, I did have a chance to look over a few slogs, and came across one particular slog that stood out from the rest. Having no graded work, labs or any feedback for a solid month, and being an evening student, which naturally means little access to the office hours, this slog really was a helpful resource, not just for having something to compare my own labwork against, but also having a different insight and perspective of the topics covered on a weekly basis. And helpful, might I add, is an understatement. I owe a special
thank you to you,
AntiAromatic, whoever you are. Drinks are on me, if we ever meet.
Week 6 - Object Oriented Programming
Looking back at Object Oriented Programming (OOP), before we had been introduced to the concept, much of the code we had written was largely a disorganized series of functions, and truthfully, I had little idea of the concept of breaking down functions into methods contained within objects, which could all function in unison as modules. This became clearer throughout the assignments, in the way in which the starter code was provided to us. It made sense to have an overarching class for game strategy that would inherit the attributes of a random or minimax strategy class if called upon. It made perfect sense to have a master game view module that would call upon game state, which would then call upon tippy's or subtract square's own state when whichever was in play. I think my underline impression of OOP is that it adds organization, structure and flexibility in modularity to code writing. If you for instance, wished to add a difficulty level in a game design, you could do so without affecting certain existing classes of difficulty levels.
Week 7/8 - Recursion & General thoughts
Throughout Week 7 and 8, our focus was on binary tree structures and linked lists. Finally, something more digestable, but still with some aspects of recursion here and there - a topic I found most challenging and admittedly dreaded... yet strangely fascinated with.
For the most part, working with nested list structures earlier in the term was understandable. Essentially, in a recursive function there's the base case and general case that follows this format:
def recursive_function:
if # a condition to detect the base case:
(do something without recursion)
else #if the general case is encountered:
(do something that involves the recursive function
Once we moved to binary trees, the order in which the general case and recursive calls also started to matter, further adding to yet another layer of complexity, may be that's not the right word. As an example, if you were to look at preorder visit below:
def preorder_visit(root, perform):
''' (BTNode, function) -> NoneType
Visit each node of BT rooted at root in preorder and perform.
>>> b = BTNode(8)
>>> b = insert(b, 4)
>>> b = insert(b, 2)
>>> b = insert(b, 6)
>>> b = insert(b, 12)
>>> b = insert(b, 14)
>>> b = insert(b, 10)
>>> def f(node): print(node.data)
>>> preorder_visit(b, f)
8
4
2
6
12
10
14
'''
if root is None:
pass
else:
perform(root)
preorder_visit(root.left, perform)
preorder_visit(root.right, perform)
but instead, if you had reversed everything following the else statement to:
preorder_visit(root.left, perform)
preorder_visit(root.right, perform)
perform(root)
You could easily and inadvertantly end up with a postorder visit function.
Week 9 - TT#2
This was the week we had our second midterm. I was pretty ashamed of myself for missing the arity question. Literally a throwaway. I had always assumed that arity meant the maximum branching factor at some node in a tree structure. A tree of height 3 and arity 3 with the greatest number of nodes would look like this. This I get, or got rather.
O
/|\
O O O
(I really should have done this on paint)
/|\ /|\ /|\
OOOOOOOOO
Now what about the same tree of height 3 and an arity
up to 3 with the least number of nodes?
O O
/ \
O & O
/|\ \
O O O O
This I didn't. Can you guess which one I wrote? :/
Week 11
At long last, we arrive at week 11. The Strike ended on Friday, March 27th with a vote to settle through binding arbitration. I can't decide if I'm actually relieved or mildly disappointed that it's dragged out for so long and the weight of our course work has changed. Again. This week's topic asked us to revisit an earlier slog to see whether we agreed or disagreed with an earlier slog. Looking back at
Week 10 and having finished assignment 3 (with 30 mins to spare before the deadline :P), I can say with certainty that I was glad I went with option B, and had the opportunity to work with recursive tree structures in greater depth. And from the looks of it on
piazza, I think it's safe to say a lot of other students felt the same way. Although... I can't help but feel as though I may have missed out on something else that could have been... and gone with option A to improve my understanding of efficiency, memoization and pruning. Maybe something to return to in the summer.
Nah, I doubt it.