Friday, April 8, 2016

Week 12 Entry

This week is the last week for CSC148 and we basically just review some materials that we've learned in the past. The professor also mention some interesting mechanic in Python: for example, when we try to create a nested list using the code "[[]] * 6", the created list will not behave what we wanted it to be; instead, all the empty list in the master list will be the same object and thus any attempt to populate the list will result some unexpected result. I also discovered this another time while I was doing assignment 2 because the usual method for copying a list (i.e. list.copy()) does not really work with a nested list, so an alternate method must be use.

Overall, this semester with CSC148 has been really rewarding and I am ready for more CSC courses in the following year.

Wednesday, March 30, 2016

Week #11 Entry

For this week’s entry, I decided to revisit my first week’s SLOG and some of my views have been changed while some remained the same.
In my first SLOG, I started off by talking about how I adore Object Oriented Programming and to this day, I still appreciate its simplicity and how useful it is when it comes to developing programs that actually exists in real world situation. For example, in assignment one we develop a program that simulate taxis. What I learn from that assignment is the utilization of abstract class and I think it really helps me explore new ideas for developing an application from scratch. Another point of view that I have not changed from the beginning of the semester is how I dislike Python. In the first SLOG, I only mentioned I disliked the private attributes in Python because they are not really protected. Now I dislike Python even more because of its loose syntax. For beginners, a loose syntax rule might be useful in some scenario but for us who have the experience in programming, this will more likely to cause trouble. For example, we cannot restrict the type of parameter passed into a function/method; so what often happen is I receive an error message in a line but the actual root of the problem is in another line where the wrong type of parameter somehow pass the code. In other programming language like Java, this type of error can be easily prevented as soon as the compiler detects the type contract has been violated so it’s easier to debug.
My view on recursion has changed throughout the semester if I look back at my first week’s SLOG. In week one, even though I had some background knowledge about recursion but I held no confidence in my ability to write one. However, after the intensive training along with professor’s amazing lecture, I am now confident about writing recursion; in fact, I think writing recursion is really efficient and fun to code.
As a conclusion, this course has been a really rewarding and fun experience to me, I am now looking toward to learn more about computer science in the following CSC courses.

Tuesday, March 29, 2016

Week #10

In week 10 we started talking about recursion efficiency, which is what I've always been waiting for since the beginning of the semester. I would really like to know what techniques or strategies we can use to decrease the run-time of our programs. The professor use the famous example of Fibonacci numbers to show us how we can massively reduce the run-time by memorized data that we have seen. However, when we increase the input to some really large number, the recursion still dies and seems to take forever to calculate. I was a little bit disappointed to some extend because the professor didn't talk about what are other techniques that we can use to further improve the program; however, it might just be the case that there isn't anything we can do about it and for a simple program like the Fibonacci number, we cannot improve it any further.
Another topic that I found interesting this week is the quick sort algorithm. I've only seen how it works on some diagram but never understand how it truly works. In addition, I now understand why computer scientists say quick sort is best with random order list because if we have a sorted list, then using quick sort is simply not very efficient since all the elements will be group to one side.

Week #9

During week 9 we've talk about mutating a tree, that is, insert and delete a node from a tree. On a first sight I knew delete will be much more complicated than insert because if we have a very large and complicated tree, then deleting a node will mean that we need to consider many cases or ifs. The algorithm given by the professor proved my thought. However, I did find that writing out algorithm for a complicated method/function does help much than just thinking about it in the head. Maybe in the future when I encounter such task I can try first write down the algorithm instead of immediately start coding.

Week #8 Entry

This week we talked about traversal and binary search tree. To me these two concepts are relatively new.
For me perhaps the hardest part for traversal is the level-order visit. This concept is extremely easy to understand, however it is somewhat difficult to implement when I first try to do it during lab. Later on in the lecture the professor offers two ways to implement level-order visit, I personally prefer the iterative deepening not only because this method is easier for me to understand but its name also sounds cool.
On the other hand, binary search tree isn't much of a surprise for me since I have already encountered something similar before, i.e. the binary search. These two concepts are essentially the same; both require a sorted list/tree and we abandon half of the data by only checking one value.

Wednesday, March 2, 2016

Week 7 Entry

For the past few weeks we have talked about recursion, a topic that I am familiar with in high school. However, it is still a fun and rewarding experience to extend my knowledge about recursion in CSC148.

There are several ways recursion is used or analyzed differently in lecture from how I learned it before, but perhaps the most obvious one is tracing recursion. In high school, we don’t tend to have a structured method to trace recursion, rather we often carry the parameter along as we trace the code solely in our mind. For example, suppose we have a recursion that finds the maximum value in a list with depth greater than one, then how I would trace recursion in the old way is to actually take the list in the parameter and goes through the code one by one in my mind without writing down anything until I reach the base case. The downside of this method is I often find myself stuck in a logical loop with complex recursions and unable to keep track of all the small pieces of the parameter as it is being breakdown by recursive calls. Now with the new method taught in lectures, tracing recursion has become easier for me to do.

Another interesting topic about recursion that we have discussed in class is recursive graphics.  I am always fascinated by recursive images because they are complex on the visual, but the actual code that produces these images are often easy to understand, at least for the recursive images I have encountered so far. If possible, it will be really interesting to see more lectures about recursive graphics in the remaining time of this course so I can learn more about how to produce complicated yet beautiful recursive images.

Thursday, February 25, 2016

Week #6 Entry

This week we finally start recursion; I'm very excited because this is what I have been waiting for since the beginning of this semester. I notice that the way how the professor trace recursion is a bit different from what I learn in high school: it's more organized and simplified. To me, it is a efficient way since sometimes can get complicated and extremely difficult to trace without organization.
Also we saw an example with recursive images. In high school we also did something similar (e.g. snowflakes) which was a fun experience. Recursive images are so easy and interesting to produce is because what we need to do is only write code for one "branch" and the rest of the "branch" will self-complete, reducing large amount of time of me scratching my head and figuring out the angles between each "branch".
In general, this week is rewarding to me and I am looking forward to learn more about recursion.