Monday, March 24, 2014

Trees

The topics after recursion, is a brand new list type called trees. From the lectures, we have learned that trees are lists that consist of different parts like root, node and leaf. However, the most important part that I feel is the fact the Trees are actually recursive other than ordinary lists which are just ordered the way how you stuck an element inside it. This property of trees is very beneficial towards data storing, because the way that trees are implemented helps user to find an exact element so much quicker and is very organized in the way that if some parts are missing it can restored easily based on the rest.  Personally, in this stage i find Trees are pretty complicated for me to understand, especially using recursion to build different method for it. The reason why that I find it hard is because, Trees combines the knowledge of data structure and recursion, and this is quite mind bending which I'll spend more time to understand in the future.

Saturday, March 8, 2014

Third entry

Continuing from week 3 , we went deeper into recursion and learned all different kinds of recursion structure. Recursion is the act of calling itself inside the function, this helps us as a programmer to write code much more efficient and easier for others the understand. For example, if u want to find the sum of a list using the methods from beginning,  we might have to find the sum of individual  elements and store it at a place then add them up.However, by using a recursion method we can find all the sum for each element at once and it will shorten the code by a lot. My biggest problem for now, is to trace a given recursion and how to discover the base case for some kind of required method. I guess i just need to practice and see more kinds of recursion until i can manage it well.