Understanding Logic and Algorithms

Understanding Logic and Algorithms


Understanding Logic and Algorithms
, Understanding algorithms is very closely related to the word logic, namely the ability of a human to think with reason about a problem to produce a truth, proven and acceptable to reason, logic is often associated with intelligence, someone who is able to speak well often people call it a smart person. In solving a problem, logic is absolutely necessary.

Logic is identical with reason and reasoning. Reasoning is a form of thinking. Thought is indirect knowledge which is based on the direct statement that thinking may be true and maybe not true. The logic definition is very simple, namely the science that provides principles that must be followed in order to be able to think valid according to the rules. The logic lesson raises awareness to use principles to think systematically.

Logic comes from the Greek word LOGOS which means science. Logic can be interpreted as knowledge that teaches ways of thinking to carry out activities with a specific purpose. The algorithm comes from the name of an Arab scientist named Abu Jafar Muhammad Ibnu Musa Al Khuwarizmi the author of a book called Al Jabar Wal Muqabala. 2 The word Al Khuwarizmi reads westerners into Algorism which then gradually becomes the Algorithm absorbed in the Indonesian language into Algorithms. Algorithms can be interpreted as sequences of problem solving that are arranged systematically using logical language to solve a problem.

However there are several other algorithm definitions. Among them, according to Rinaldi Munir, the algorithm is a sequence of logical steps to solve problems that are arranged systematically. While according to the Big Indonesian Dictionary, the definition of an algorithm is a logical sequence of decision making for problem solving. According to the Gunadarma team: 1988, the algorithm is a finite set of instructions that clearly specify the steps of the implementation process, in solving a particular problem, or a particular class of problems, with the demand that the set of instructions be carried out mechanically. From the above understanding, it can be concluded that Logic and Algorithms are the study of how to solve a problem based on the sequence of limited steps arranged systematically and using logical language with a specific purpose. To more easily understand the meaning of the algorithm an example of the problem of exchanging the contents of two glasses is exemplified. Given two glasses A and B, the glass contains tea water and a glass of coffee water. Exchange the contents of the glass so as to produce a glass which originally contained tea water to contain coffee water and a glass which originally contained coffee water to be filled with tea water. Illustration of this problem can be seen in Figure 1.1.
Figure 1.1. Exchange glass of glass A and glass B. 



The way to resolve this problem is as follows. To exchange the contents of the glass properly, it is necessary to add the glass we call glass C as a temporary shelter. Here is the algorithm:
1. Prepare a backup glass C
2. Pour tea water from glass A into glass C (glass A becomes empty).
3. Pour coffee water from glass B into glass A (glass B becomes empty).
4. Pour tea water from glass C into glass B. Illustration of the steps of the algorithm can be seen in Figure 1.2.
Figure 1.2. Steps for exchanging glasses of glass A and glass B.

From this example it can be seen that the solution to the problem of exchanging the contents of two glasses is very simple. Here is used a sequence of steps that are reasonable or logical so that the contents of both of them have moved media, from A to B and B to A. This is what is called "Algorithm", the sequence of solving a problem in a logical and reasonable sequence and step produces something correct.
Another example of using logic and algorithms is to create an algorithm to calculate the area of ​​a circle, the way:
1. Determine the radius value (r) of the circle.
2. Determine the value of phi.
3. Calculate the area of ​​a circle by multiplying the value of the radius (r) by (r) then multiplying by the value of phi.
4. Then the area of ​​the circle is found.
5. Finish. When using logic, you should not think too complicated about a problem, because it is not necessarily a problem that is as complicated as we think.
Think of the simplest things to solve the problem, so it doesn't get stuck in complicated, self-made thoughts. However, don't underestimate the slightest problem, but think simple to produce an effective solution.
In determining the algorithm to solve a problem, maybe we are faced with several algorithm choices. Therefore we must have a guide in determining algorithm choices. Consideration in algorithm selection is, first, the algorithm must be correct. This means that the algorithm will provide output as expected from a number of inputs provided. No matter how good an algorithm is, if it gives the wrong output, then surely the algorithm is not a good algorithm. The second consideration that must be considered is that we must know how well the results achieved by the algorithm. This is especially important in algorithms that require approximation of results, namely algorithms whose results are only approaches. A good algorithm must be able to provide results as close as possible to the actual values. Third is the efficiency of the algorithm. The efficiency of the algorithm can be viewed from two things, namely the efficiency of time and memory. Although algorithms provide the correct or closest output, but if we have to wait a long time to get results such as hours to get the output then usually the algorithm will usually not be the first choice, everyone wants a relatively fast output. Likewise with memory, the greater the memory used, the worse the algorithm will be. In reality, everyone can create different algorithms to solve a problem, even though there are differences in compiling algorithms, of course we expect similar or similar outputs. If faced with problems like this then you should choose the most efficient and fast algorithm.
The purpose of learning logic and algorithms is to be able to get used to doing a plan when solving a problem. Because a problem that is solved with a mature plan will get a more optimal solution than solving the problem without using a plan.

Posting Komentar

0 Komentar