Looking back on my weeks in this course, I can honestly say that, for me, recursion ended up somehow being the easiest, the most difficult, and most interesting topic touched upon this year, all at the same time, and so I think it is most appropriate that I review my first impressions of tracing recursion.
One of the first things I notice about my initial impression of tracing recursion is that I immediately acknowledged that it was a complicated concept, but that I also found it to be fairly easy. I would probably attribute this to the easiness of the questions provided for us at the time, because since then, we have seen much more complicated examples of recursive functions, like the minimax algorithm. However, it is probably due to all the practice with tracing recursion we got that we were able to understand and even develop our own recursive functions. With this in mind, I can honestly agree with myself that 'it gets easier with practice'.
It seems that I was not the only one who initially found tracing recursion 'easy'. Ji Yong (http://148choi.blogspot.ca/) accurately predicted that while tracing it was easy, building recursive functions would be less so. The difficulties of recursion escalated quickly when it came to examples such as traversing trees, but once again, I must agree with my initial reaction, which was that everything is nice and easy once you find a way to reduce whatever is given to the base case of choice.
All in all, recursion is definitely a multifaceted concept, and I definitely did not see it being as complicated as it would come to be, unlike some of my peers. Perhaps I was naive, but now I know not to underestimate the power of recursion. On the flipside, the practice that we got definitely helped with my understanding, and as a result, I got a grasp on recursion rather quickly. Here's hoping we discover more uses for this fascinating concept.
Maximum recursion depth exceeded.
Friday, 27 March 2015
Saturday, 21 March 2015
Week 9 impressions: CSC148 - Introduction to Dendrology
I think that CSC148 should be rebranded as 'the study of trees', or, 'an intro to Dendrology', because by all that is good in this world, there are a lot of trees in this course.
This week focused on Binary Search Trees, which is a Tree ADT that uses only 2 child nodes per parent node so as to speed up searching through large amounts of data. Every node has a 'left' child and a 'right' child, and it is assumed that there is a distinction between what goes left and what goes right. The most common use for a BST was searching for a specific integer. In an integer BST, an initial integer is chosen to be the initial node. Smaller integers are placed to the left of it, and larger ones are placed to the right of it. This pattern holds for all nodes in the BST, and what you're left with is a tree that is organized from smallest to largest. This structure is helpful in speeding up searches for specific integers, since it eliminates either the entire left or right portion of the tree right at the beginning, and it cuts the search time by a hefty amount.
In fact, searching through an organized binary search tree is so effective that it uses logarithmic runtime, which means that the runtime of the search algorithm increases logarithmically as the number of elements in the tree increases.
There are, of course limitations. The BST has to be organized before you can use such an algorithm, so the data type isn't intrinsically efficient. Still, if we were to keep this in mind while creating a BST, we'd find that it is one of the most efficient algorithms we've learned thus far.
Thursday, 12 March 2015
Week 8
Linked lists are pretty cool. Not quite sure how we're gonna use them yet, but they are still pretty cool.
In week 8, we were introduced to linked lists. Its an ADT that does 2 things: for one, it stores data at at its nodes, and secondly, its nodes point to other nodes (unless you're at the end of a linked list), so you can traverse the list by following the chain of nodes that point to each other.
I suppose that focusing on linked lists was a welcome break from recursion, but my main issue with linked lists is that I have no idea what makes it more useful than a generic list. I mean, you can traverse a list in a similar way, and lists are already built into Python, so there's no added code required to work with them.
I'm sure this will be cleared up soon, but for now, I'm interested in the topic, but not sure how its useful.
In week 8, we were introduced to linked lists. Its an ADT that does 2 things: for one, it stores data at at its nodes, and secondly, its nodes point to other nodes (unless you're at the end of a linked list), so you can traverse the list by following the chain of nodes that point to each other.
I suppose that focusing on linked lists was a welcome break from recursion, but my main issue with linked lists is that I have no idea what makes it more useful than a generic list. I mean, you can traverse a list in a similar way, and lists are already built into Python, so there's no added code required to work with them.
I'm sure this will be cleared up soon, but for now, I'm interested in the topic, but not sure how its useful.
Tuesday, 3 March 2015
Week 7 Impressions
Despair.
That's what week 7 felt like.
No, not the content being difficult. The assignment.
Assignment 2 has officially made week 7 one of the most stressful weeks of the year. You see, the concept of the assignment is simple. Implement Tippy, and then program a strategy that will always win at it. Simple enough, right?
Wrong.
When implementing the function for Tippy that determines if the game is over or not, I ended up making a function that went well over 200 lines. It looked like a gigantic lightning bolt because of all of the loops I implemented. When I showed it to one of my partners, he looked at me in disbelief, asking how on Earth a function could possibly be that long, and maintaining that there must be a simpler way to do it. We eventually cut it down to a reasonable size, but it took a lot of modification to make the function somewhat presentable.
Minimax is a whole other beast. Understanding the concept gets you nowhere if you aren't 100% confident with how you're implementing it. One problem we had to avoid is an aliasing problem. When we broke down the initial Tippy gamestate into all of the possible gamestates, it altered our original gamestate and filled it with 'x's everywhere.
It seems like we still have a lot of work to do.
That's what week 7 felt like.
No, not the content being difficult. The assignment.
Assignment 2 has officially made week 7 one of the most stressful weeks of the year. You see, the concept of the assignment is simple. Implement Tippy, and then program a strategy that will always win at it. Simple enough, right?
Wrong.
When implementing the function for Tippy that determines if the game is over or not, I ended up making a function that went well over 200 lines. It looked like a gigantic lightning bolt because of all of the loops I implemented. When I showed it to one of my partners, he looked at me in disbelief, asking how on Earth a function could possibly be that long, and maintaining that there must be a simpler way to do it. We eventually cut it down to a reasonable size, but it took a lot of modification to make the function somewhat presentable.
Minimax is a whole other beast. Understanding the concept gets you nowhere if you aren't 100% confident with how you're implementing it. One problem we had to avoid is an aliasing problem. When we broke down the initial Tippy gamestate into all of the possible gamestates, it altered our original gamestate and filled it with 'x's everywhere.
It seems like we still have a lot of work to do.
Subscribe to:
Posts (Atom)