Deeper into Algorithm

Algorithm is one of the most interesting lessons for me because it involves a lot of problem-solving concepts but we solve those problems by using smart and efficient formulas. During the course of algorithm, I am introduced to two new types of algorithm.

Our teacher (Cindy) gave us an extremely hard task which requires us to find the sum between 1 and 200 (1+2+3+4+5……200) with a limited time. As a result, all of us got the answers wrong in the first time; however after we are introduced to the formula to solve this problem which is (n+1) x (n/2), we could solve other problems that have the same goals so easily. We can take 200 which indicates n + 1 which is 201 to multiply with 100 which gives us the result of 20100.

Another algorithm that we have learned is divide and conquer. It is an algorithm used to solve problems by breaking it down into smaller pieces until we can manage to find the exact answers by following the same patterns of dividing over and over again. This is one example of a problem that can be solved using the divide and conquer algorithm:

In a museum, there is an ancient sculpture that has lasted since the very first centuries of human existence. Since it is a really important sculpture, there is a camera that takes a picture of the sculpture once every five minutes. One day, the security guard found it was missing during 8 am off Monday and 8 pm on Tuesday. Find out the exact time that the sculpture was stolen.

If I am not introduced to algorithm yet, I would find this problem as a days-long riddle in order to be solved. However, by using the divide and conquer algorithm, we can easily solve the riddle by using a simple pattern. First of all, we would divide all of the possible time for stealing the ancient sculpture into two. Then, we will ask for a photo from the camera that has taken during 8 pm on Monday which is right in the middle of 8 am on Monday and 8 pm on Tuesday. The next steps depend on what the photo shows; if it shows that the sculpture is still there at the time that the photo has taken, then it means the stealing happened later after that and if the photo does not show the sculpture, it obviously means that the sculpture was already stolen before this photo is taken. Then we can ask for a photo in the middle of each possible moments and continue the dividing until we find the exact moment that the sculpture has been stolen.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *