Sunday, 23 February 2014

Week 6 - Trees

So this week, the subject of interest in lectures this week were data structures and one of the concept of organizing data was through branches and leaves or data trees. Of course data trees doesn't actually involve physical trees, branches nor leaves rather they are nothing more of than an analogy of organizing data through means of true and false statements/ binary comparisons and causing new 'branches' to grow with its own 'leaves'. Methods as to how to form these trees were also discussed, which included post-order, pre-order, in-order traversals where it would lead to the exact same tree at the end however the methodology being different.  Another form of organizing data was through linked lists where we quite literally have a list linked to a new list which is repeated over. In doing so we have a new analogy to work with, tails and heads where it represents the flow of data. For example, the head would indicate the list moving forward whereas the tail would represent the data prior or the origin. As I have said before in the past weeks, this so far is nothing new as I remember this being taught in high school and i distinctly remember analyzing data trees from both school assignments as well as from competitions i have participated in, in the past. However, I'm also aware that data structures was second to last thing that was taught back in high school. I distinctly remember in high school that the last topic covered was working with UIs and and GUI. Oddly enough, I found working with GUI and UIs to be the annoying as well as challenging of course this was all taught in Java and not Python.

Sunday, 9 February 2014

Week 5 - Assignment 1 Progress

Well, I decided that it's probably time I spent more time and thought into the assignment this week considering it's due next week. As such, this week's slog will be going over what has been discovered while trying to solve and code the Towers of Hanoi problem. As of now, most of the main components of the program has been solved such as the recursive function responsible for finding the solution to the problem.  The solution to the problem simply involved 2 recursive functions each designed specifically for either a 3 spool or 4 spool game where the function repeatedly calls itself to find the most optimal solution. The conditions are met through a series of if statements which decides where and how a cheese on the selected spool moves based on the relative sizes of the cheese in question. The main difficulty of writing the code however was the fact that the required functions was dependent on the starter program, whereby it took time to read through the starter code to understand what the functions did as well as call. As a result of dissecting the code, I was able to figure out the function calls that was missing and thereby write one up so that the code runs. Unfortunately, it would seem that the GUI will take some time to implement because I have yet to understand how it runs. This will probably be solved by later on as I start drawing conclusions and experiment with the code.

Sunday, 2 February 2014

Week 4 - Recursion

So this week was all about recursion and understand how to both code and analyze recursive functions. The idea behind a recursive functions is easy however analyzing recursive function can easily get complicated; often requiring multiple iterations where its easy to make mistakes.I have done this before in high school so the concept of recursive functions is not new to me however, I know that these functions can get really complicated and often back-tracing can be hard. The way I imagine recursive functions is a series of nested while loops. Where the code constantly calls its self repeatedly to get a desired number or value of some sort. As you get your value, you feed it back up the x number of loops or iterations of your code to get your final answer. This code can be used for things such as permutations, where writing a code that runs a finite time can be tedious and or impossible. One of the examples I've learned from high-school is the Sierpinski's Triangle where you draw x numbers of triangles within a larger triangle with y number of dots. As one can see, a writing a finite code can get complicated  whereas a recursion code simplifies it. Anyhow, as of this point of the course, I don't think I'm lost or learning something completely new as of yet although practicing back tracing as well as writing code can be helpful in avoiding errors.