2012年11月25日星期日

long time no see csc.

Hi Long time nooo see my lovely blog. I just want to share some of me thoughts on the idea of recursion... I found it's very very intriguing. Recursion is the process of repeating items in a self-similar way. It's a very useful and common application in computer science. Fibonacci sequence is a classic example of recursion. Fibonaccis sequence first appears in Indian Mathematics. The sequence is defined in the following term:

Fn=Fn-1 + Fn-2.

A Sierpinski trangle is also a classic example for recursion. This special form of triangle can be formed in the following steps:

1. Start with any triganle in a plane. Equilateral triangle can produce the best visual result.
2. Shrink the triangle to 1/2 height and 1/2 width, produce 3 shrunken triangles so that each triangle touches the two other triangles at a corner.
3. Repeat step 2 with each of the smaller trangles...

To understand recursion, I realize that there is a distinction between a procedure and the running of a procedure. Procedure is like a recipe, while running the procedure is actually preparing the meal. Recursion is part of algorithm, in that sense. One has to grasp the fundamental rule in one problem to solve or create a complex recursion system.

2012年11月6日星期二

challange...

It's been a busy week so I haven't got time to update my slog... This is the "make-up" slog. There are so many things I want to talk about... First the project, and then the tutorial exercises on chapter 15 conditionals...

First, the project is very annoying for me. The only thing I need is a clear mind and patience, patience, patience. There are many times I lost my patience and I couldn't spot the easiest and simplest error. I want to finish this project as soon as possible, because there are many things from other courses to do. But the more I think like this, the more impatient I became... I can only change my time policy by finishing as much as the first project first before going to the next one.Only focus on the present! haha.

The second thing I wanna talk about is the conditionals. It's a very intriguing topic for me. More and more I found computer is a language, and it has its dedicated, special logic... I have to follow this logic carefully, in other words, think like a computer! It sounds weird but this is the only way to better adapt to this system. I remember the tutorial exercise from last week, on conditional. The "reply" exercise was kind of tricky.. It asks me to develop a function which takes a string: Good morning/good afternoon/good evening, and reply several different phrases. I couldn't figure out the code: (string=? greeting "good morning"). I didn't know the meaning of "=?" . Then I asked my TA, she points out the string=? meaning if the string present in "greeting" equals (the same) with the string "good morning". If they are equal, the function will automatically produce "I need a coffee". This is very fun! And if all things are wrong in the function, the system will go down to the "else" condition. which means if all the conditions failed the function will produce something from "else" function...

I did not do this correctly on the quiz. Hopefully I could learn from this mistake! Condition is a very useful tactic I could use in the future.