Wednesday, March 26, 2014
Week 10 - A2 Part 2
Monday, March 17, 2014
Week 9 - A2 Part 1
The first part of thus assignment for me was really vague. I honestly really had no idea what to exactly do. My group and I had go to through several revisions and complete overhauls of our code in order do create a correct Binary Tree Class. We started off with very little inheritance and eventually realized that most of the code, dependent on how we wrote it could easily be inherited from sub class to another because some of the codes were very similar. Thereby, reducing the amount of duplicate code. That was a hard part of this assignment, reducing duplicate or similar code. By reducing the amount of code and inheriting more of your code, you are able to reduce the chance of bugs and reduce the amount of work you have to do. Reducing the amount of work you have is a crucial and critical part of studying comp sci. The less work you have to do to get the job done, the better.
Week - 8: Linked List
Saturday, March 1, 2014
Week 7 - Recursion
By breaking down the problems into its base cases, it allows to solve many versions of the same problem if they have all the same base cases. Therefore, this technique is really useful to use because it reduces the amount of code. Many of the big problems can be simplified to its base cases and allows you to be lazy and solve the big problem with relatively few lines of code. Being lazy is of the greatest skills of a computer scientist. Also, the code is really efficient in that it doesn't require lines and lines of code. A problem can be solved recursively simply using 1 line of code. Therefore, recursion is really useful technique.
A prime example of using recursion to solve the problem at hand which was moving cheese across the four stools in A. The stools were a nested list where each stool was list that was inside a big list that holds all the stools. Therefore, this was a problem that could be solved very easily using recursion because there were base cases that could be used to solve the bigger problem. The base cases were moving a cheese from origin to destination, and moving two cheese from origin to the destination. By breaking the overall big problem of moving several cheeses across 4 stools into the base case of either moving 1 cheese or 2 cheeses, the solution of the problem was slowly built up. What I mean by the solution was built was that because you know how to move 2 cheeses, you know how to move 3 cheeses and because you know how to move 3 cheese you know how to move 4 cheeses is which just moving 3 cheese plus moving 4th cheese i.e one cheese from the origin to the destination.
Friday, February 21, 2014
Week - 6: A1 Completed
The concept of trees was a fairly simple concept to understand. On the other hand, unit-testing is still a bit difficult for me code out. I still keep on referring back to previous labs and like looking up the API on how to use certain methods in the class unittest. I think I just need a bit more practice on it especially considering its on the first term test.
Sunday, February 9, 2014
Week 5 - A1
The tour.py algorithm for A1 is really really annoying because when trying to find the algorithm, the tracking of which variables are which gets so confusing especially once you add more and more cheeses. I have been lost in my tracking of the variables as to which one are representing which. I don't know how many papers I have scrunched up and threw away because I got lost. However, after finally not getting lost, the feeling of accomplishment was amazing. It wasn't the best solution, but party darn close. The key to figuring it out for me was keeping track of source, dest, int1 and int2 meticulously. I drew everything out on paper and then bamn, everything made sense. Never under estimate the power of paper and pen. It is your best friend when it comes to recursion and you have to keep track of variables that change. Happy tracking.
Saturday, February 1, 2014
Week 4 - Progress
At first, I was confused too. Wikipedia attempted to explain it with many examples which to me did not help what so ever. In the end, my lab partner finally explained it to me and I got it. As it turns, I was overthinking about it. A function object is just a parameter in a function that refers to another function outside the function containing the parameter. Therefore, you don't have to call the function directly inside the function. It gets passed into the function as a parameter.
Recursion?!?!?!?
This was a fairly simple concept to comprehend, but to implement and fully understand was pretty complicated. It took a far bit of tracing before I began to understanding recursion and what it does. Recursion happens when a function uses itself in the function. I saw how it was really useful in solving problems that was really complicated to do without recursion. Simply put, recursion made solving certain problems really easy.
A1 - Brain Explosion
The assignment is really complicated and for me, really difficult to understand. I found the instructions to be really vague and I'm not really sure where to start exactly. I spent a long time just trying to see how the cheese was moved in 17 steps for only 6 pieces of cheese. Yes, I did spent my Friday night shoveling around 6 pens to try and move them across 4 pieces of paper in 17 steps. However, actually doing the program with real objects, it helped me see what things we need to do and how to do them. An example would be that each of the stools that the cheese goes on is like a stack where can you only take off the most recent one first and so forth. Hopefully a working program will be accomplished by the end of the week with another week left to further improve it.