Algorithm

This is the fifth reflection I wrote. I learned the definition and properties of algorithm. And there were algorithm magic shows and role playing activities during the class. I am going to talk about following things in my reflection.

  1. the definition and properties of algorithm.
  2. Expressions for an algorithm
  3. Designing an Algorithm and understanding the Problem
  4. Explain 3 algorithms that I learned from the video “The Secret Rules of Modern Living: Algorithms”
  5. How I would improve and apply the knowledge with computation thinking

Firstly, algorithm is a step by step clear instructions to solve a problem. The algorithms detail the specific instructions a computer should perform to carry out a specific work.Because the algorithm is precise, the order of computation is always critical to the functioning of algorithm. The algorithm has several properties, which are finiteness, definiteness, input, output, effectiveness.

This picture shows the explanation of  individual properties of algorithm.

Secondly, the expression of algorithm are consisted of Natural language, flow chart, pseudocode, and programming Language. Natural language is simple English. Flow chart is formalized graphic representation. Pseudocode is generic artificial language. Programming language is artificial language to communicate with computer system.

Designing an algorithm has two main things to look at. One is the big picture, what is the final goal. The other is the individual stages, what barriers need to be overcome on the way. Before an algorithm can be designed, it is important to check if the problem is well understood. We need to ask ourself some questions checking if we understand the problem. Those questions include:

  1. What are the inputs into the problem?
  2. What will be the outputs of the problem?
  3. In what order do instructions need to be carry out?
  4. What decisions need to be made in the problem?
  5. Are any area of problem repeated?

“The Secret Rules of Modern Living: Algorithms” introduces us several amazing algorithms that benefits us in our daily life. I would explain three of those amazing algorithms.

  1. Face detection
  2. a mathematical game with a jar full of chocolates and one red hot chilli 
  3.  Euclidean greatest common divisor

Face detection belongs to the category of computer vision. In the early days, people’s main research direction was face recognition, which means that the identity of a person is recognized according to the face. Later, the face detection needs in complex backgrounds are getting bigger and bigger, and face detection is gradually increasing. Developed as a separate research direction.

“The knowledge-based approach mainly uses prior knowledge to treat faces as a combination of organ features, detecting faces based on the characteristics of organs such as eyes, eyebrows, mouth, nose, and geometric positions. The statistical method is based on Think of the face as a holistic model—a two-dimensional pixel matrix. From a statistical point of view, the face pattern space is constructed by a large number of face image samples, and the presence of the face is judged according to the similarity measure. Under these two frameworks, A number of methods have been developed. At present, with the continuous introduction of various methods and changes in application conditions, a comprehensive system combining knowledge models with statistical models will become a future research trend.” (From the paper “Adaboost-based face detection method” And eye localization algorithm research)

How face detection is achieved

There is a math game with a jar full of chocolates and one red hot chilli. Two people play the game, each person can take out 1 or 2 or 3 chocolates from each time, the pepper can only be taken at the end, whoever has to take the pepper will have to eat her, and lose.

The strategy is, if the number of the chocolate could be divisible by 4, the other people take the chocolate first and he can take 1 or 2 or 3 chocolate. Then you take the chocolate in the next, you take the number of chocolate that equals 4 minus the number that the other people just take. If the number of the chocolate could not be divisible by 4, you take the chocolate first. After you take the chocolate, the number of the chocolate is always divisible to 4.

In short,

The algorithm is to find a balance point.If the initial state is balanced, then the other party will come first, let him break the balance, and then he will maintain balance again.If the initial state is not balanced, then you should come first, maintain balance, then let the other party break, and then maintain balance yourself.

The Euclidean algorithm is the greatest common divisor used to calculate two positive integers a, b.

This is because The greatest common divisor of two integers is equal to the greatest common divisor of the smaller integer and the division remainder of the two integer.

when the added number is 0, the greatest common divisor of two integers is 1

This week, we had several activities in the class. The first one is role play. Lucybillact as a blind robot that need to catch a bottle in the desk. Kingsly was the person who gave order to Lucybilly teaching telling her how to get the bottle. They did catch the bottle. I learn from this activity that order need to be specific, or the order would fail the whole process.

The second activity is guided tour city tube map. We need to find a route that goes through all the tourist attraction without repeating journey. Such activity benefits me in the real life. Because when I visit a city, I can plan a route pass through every site that I hope to visit without repeating journey. I would save the time and cost of the transportation as the high efficiency of the route.

We designed several algorithm this week. The most impressive one is about recognizing parity. It can determine the parity of the numbers that if the numbers are divisible to 2. It can determine the parity of the numbers that if the last digit of the numbers is”1″in binary system. The reasons why this algorithm impressed me is the involvement of two solutions other than one solution. I learned that everything could be. solved in more than one ways.

Magic show this week took a lot of time of us. We prepared it until the dawn is coming. The magic has four step:

  1. rank the card from 1 to 54. The card has individual serial number 
  2. remember the content of the card 16. The card is in 16th of those 54 cards
  3. dividing those 54 card into two group. Each group should have number between 16 to 32 due to the position of card we just remember.(all card are facing up)
  4. we pick the group of card that contain the 16th card.
  5. we process those card. one card face down, next one face up in another group. ( process 1)Repeating step 4 and 5 until there is only one card. ( so we might have process it for 4 to 5And that card is the card we pick in step2
The magic card

We might wonder, why 16. 2 to the power of 4. Step 4: one card face down, next one face up in another group. we process those card. one card face down, next one face up in another group. ( process 1) if we do it again, we call it process2 or 3 or 4 or5 and so onThis magic is a classification system. The number are classified by their divisor of 2. We say 1 to 54. Those are the serial number of the card.1 equals 2 to the power of 0, so it is classified as those humber that have no divisor to 2. Which this process are done in the process 1 in which you just manipulated the card for once. 16 is classified as those number whose divisor of 2 have the power of 4. So the system works as classification system.

We could say the magic classify the card due to order of the card in  binary system as well. I mean the classification system has nothing to do with the content of the card, just relate to its serial number. So we translate the serial number of the card from 1 to 54, in binary system. During the process 1, if the binary number has 1 in this line, it is classified Into one category, as we make it facing down and discard it later. And in second process, we do this again, card that are not discarded in the process one, whose serial number  could be exact divided by two, are manipulate similarly. Serial number that has 1 in this line, are classified as another category, which is discarded. So 16 would not be discarded for a long time. After process 4, all the card that can not be exact divided by 16 is discarded or we could say have already classified into other category. So only serial number 16 is left. 

I was in charge of explaining the logic of this magic show. So I have a deep understanding of this magic show. Therefore my skills of computational thinking is developed. I used decomposition to give each card a serial number. I used abstraction to group those card by their serial number. I used pattern recognition to estimate the attribution of the card. I used algorithm to figure out which card is survived. Using computational thinking to solve and study real life problem makes my computational thinking skills to be more proficient, and I benefit from that.

In conclusion, this week, CS class pushes the gate of algorithm for me. Therefore, my skills of computational thinking improved that I could tackle with real life problem by using computational thinking skills, which benefits me a lot.

Leave a comment