This week we learned about mutating binary search trees. Inserting and deleting data from a binary search tree is takes more effort than it would on an arbitrary tree, due to the nature of the tree. Data less than the node goes on the left, greater on the right, so an insert function would have to handle this accordingly. Deleting also takes some effort, since if the node you are deleting has children, you would have to deal with how to take care of the child node. Overall, a fairly straightforward if not annoying concept.
In terms of coursework, we had a test to take on the same day, which covered recursion and recursive data structures. We were given questions that dealt with linked lists and trees and such. Difficulty was fair, as doing prior labs and term tests helped in preparing for this.
Monday, 23 March 2015
Tuesday, 17 March 2015
Week 9
In week 9 we continued learning about recursive data structures, with the introduction of linked lists. A linked list consists of 2 things, a node with data and a child node, and a wrapper showing the front and back of the list. Crawling the list requires you to iterate through each node until you reach the back of the list. Linked lists are pretty straightforward and I had little difficulty learning about them.
Aside from this, there is also the second term test happening this week. I'm not sure how it'll work out with the TAs being on strike and all. The test will be mainly on the recursive data structures we have learned so far. The test shouldn't be too bad, as I am fairly comfortable working with the material.
Aside from this, there is also the second term test happening this week. I'm not sure how it'll work out with the TAs being on strike and all. The test will be mainly on the recursive data structures we have learned so far. The test shouldn't be too bad, as I am fairly comfortable working with the material.
Sunday, 8 March 2015
Week 8
This week we have learned more about recursive data structures. We learned about binary trees and their uses. Binary trees are a data structure in which each node of the tree contains data and up to two child nodes. The children are ordered such that data with lesser value go on the left while data with greater value go on the right. Uses of this include arithmetic and efficient searching of data. I personally like this type of data structure because it is simple, intuitive and efficient.
Aside from learning about recursive data structures, there is also an assignment due this week. It involves making a game and a strategy for that game that always wins if possible. We have to make use of our past knowledge of classes and recursion in order to finish this assignment, which is a rather difficult one. I feel that completing this assignment will help solidify my knowledge on concepts of object-oriented programming and recursion.
Tuesday, 3 March 2015
Week 7
Recursion is another interesting yet very important concept taught to us in this class. It is a powerful concept that involves a function/method calling itself. It is a tough concept for many people to wrap their heads around, but learning it is very worthwhile, as there are many applications for recursion, even outside of computer science.
Understanding recursion takes a lot of practice. The way we were taught to think about it was to first think about the base case of the function you are designing, what the function returns at the end of the recursive chain, so to speak. After you have designed the base cases, you think about small scale cases of how the function works before the base case. This is the hard part, and requires a ton of thinking. After you get through this step, combine the 2 above steps and you should have a working recursive function.
I feel that I have a good grasp of recursion at this point in the course, mainly due to working on the labs for this course. Tracing recursion was simple enough, but making recursive functions took a lot of practice and thinking, especially for the course's second assignment. Hopefully this practice will pay off in my future as a computer scientist.
Subscribe to:
Posts (Atom)