Thursday, January 17, 2013

Weekly Log 1: Starting to Get Familiar with Algorithms


Before listening to the Computer Science lecture, I, as a not-so-much tech-savvy type, believed that computers tend to be more like artificial intelligence, which is manipulated by humans and secretly planning to free from chains. In addition to fear and concern, I, like everyone else, rely on computer programs and applications tremendously without thinking about how those amazing tools were created. After the first lecture, I sort of gain a sense of why humans civilizations need such a machine to promote progress and how programs are created. The thing is, we need computers to do work for us and facilitate our life (obviously they won't get bored). We create programs by giving computers direct and definite commands step by step to solve certain problems. Like tutoring a toddler to make a peanut butter sandwich, we need to give very specific instructions to avoid vagueness and misunderstanding.

A good example of creating simple algorithm is "Euclid's GCD" using DrRacket. To be honest, I was completely lost when Professor Heap talked about Euclid's method. Then after reading the numeric examples on Wikipedia, I understand. Now everything makes sense. However, the thing confuses me the most is the plenty of brackets needed as part of input. Guess I will develop my computer mindset along with the course.
Week 2 we dig deeper about algorithms and basically understood that algorithms are not perfect. There is no such algorithm that can solve every problem. Partially because sometimes the problem itself is self-contradictory like " this statement is false", the algorithm to decide whether declarative English sentences are true cannot process it. 

Another drawback is that algorithms may take too long when the operation is lengthy such as Fibonacci number, (by definition, the first two numbers in the Fibonacci sequence are 0 and 1 (alternatively, 1 and 1), and each subsequent number is the sum of the previous two). In order to know the (fib 30), you need to know fib 29 and fib 28, which leads to fib 28, 27, and fib 27, 26 and etc. Even computers are expected to be fast, they cannot process such large amount of operation in a short time.  The thing I found frustrating is that when professor was typing the instruction on the DrRacket platform, I had no idea how to read or interpretate those daunting codes. I really need to talk to my TA.

When it comes to debating between two algorithms designed to solve the same problem, we definitely should choose the simple one. The dictionary example illustrates how linear search and binary search work, the former clearly requires a huge amount to time while the latter is terse and fast.

When considering about creating a new algorithm, we have to know the core of the problem, then devise a plan or more plans then try the plan(s). After testing, assessment and evaluations is necessary to improve and polish the algorithm.

No comments:

Post a Comment