Wednesday, 2 March 2016

Week 7: The Interesting Stuff

As enter the week 7, concepts get more interesting to pay attention to. Before, until week 5, it felt to me like I have been learning the same things with a few modifications to them even though others were like this is all new but now, since week 6, all of sudden the concepts of recursions and trees makes me feel that I have gained so much from this course in such short amount of time. More than the further knowledge gained about the object oriented programming approach, I feel a lot more in control over how I want to design my program by choosing the most efficient approach with proper coding etiquette (docstrings and comments).

I found myself figuring out all the new possibilities with recursion. The example of a list of lists of unknown depth was really interesting. Without recursion, I can't really seem to figure out a way to search through the elements or sum all the elements. Now with just a few lines of code, I can do way more operations instead of any mess of nested for loops. Recursion looks a lot cleaner and using the method of solving the base case (depth of 0) and then looking at it for each subsequent depth case made creating recursive code a breeze.

Trees are structures of data where there is a starting point or node and directed edges pointing from that node towards other nodes which in turn point to other nodes, and so on. As a result, they are similar to linked lists as each node pints to a list of other notes who each point to a list of nodes, and so on for each node. Recursion is very useful because it allows us to access data from a collection of elements when each of those elements can have elements of their own which can have elements of their own, and so on easily by simply calling a function within itself. By using these recursive functions on trees, it becomes possible to determine which nodes are leaves and how tall the tree is.

I can totally see recursion go a long way and even in the upcoming assignment two posted this week where it is obvious that recursive approach would be used for searching all the future moves for solving the puzzles and also to confirm if there exists a solution with the current situation or not. Learning recursion has changed the way I approach computer science problems and I'm really excited to use it in my further projects.


No comments:

Post a Comment