Basic Concepts and Definitions of Logic and Algorithm

Adhi Nugro
3 min readOct 6, 2024

--

Photo by Christopher Gower on Unsplash

Definition of Logic

Logic is closely associated with the term “logical,” which means something that makes sense or is reasonable. The word logic originates from the Greek word “LOGOS,” which means science or study. The basic definition of logic is the science that provides principles to follow to ensure valid thinking according to established rules. In everyday life, logic is often linked with intelligence. A person who can think logically is often considered intelligent.

Logic is indirect knowledge based on direct statements. Thinking using logic may be correct or incorrect. Learning logic raises awareness to use principles for systematic thinking, meaning logic is identical to a structured and orderly thinking process.

Definition of Algorithm

An algorithm is derived from the name of an Arab scientist, Abu Jafar Muhammad Ibnu Musa Al Khuwarizmi, who wrote a book titled “Al Jabar Wal Muqabala.” The name “Al Khuwarizmi” was adopted by Westerners as “Algorism,” which eventually evolved into “Algorithm” in English and was adopted into Indonesian as “Algoritma.” An algorithm is a series of steps systematically and logically arranged to solve a problem.

Here are some other definitions of the algorithm:

  • Rinaldi Munir: An algorithm is a series of logical steps to solve a problem that is systematically arranged.
  • Gunadarma Team (1988): An algorithm is a finite set of instructions that detail the steps of a process to solve a specific problem or class of problems, which can be executed mechanically.

Relationship Between Logic and Algorithm From the definitions above, it can be concluded that logic and algorithms study how to solve a problem based on a limited sequence of steps arranged systematically and using logical language. The goal is to achieve a correct and reasonable solution.

Example of an Algorithm

To better understand the meaning of an algorithm, let’s look at an example of the problem of swapping the contents of two glasses. Given two glasses, A and B. Glass A contains tea, and glass B contains coffee. The goal is to swap the contents of these glasses so that glass A, which initially contains tea, becomes filled with coffee, and glass B, which initially contains coffee, becomes filled with tea.

Here are the steps to solve this problem (the algorithm):

  1. Prepare a spare glass C.
  2. Pour the tea from glass A into glass C (now glass A is empty).
  3. Pour the coffee from glass B into glass A (now glass B is empty).
  4. Pour the tea from glass C into glass B.

From this example, it can be seen that solving the problem of swapping the contents of two glasses is very simple. Using a logical sequence of steps, the contents of glasses A and B can be swapped correctly. This is what is called an “algorithm,” a series of steps to solve a problem logically and reasonably.

Conclusion

Logic and algorithms are interconnected fields that focus on solving problems through systematic and logical steps. Logic involves thinking in a structured, rational manner, while an algorithm is a sequence of steps designed to achieve a specific goal. Together, they provide a foundation for solving problems efficiently and effectively.

I hope this helps! If there’s any part that is still unclear, feel free to discuss it in the comments. 😊

--

--

Adhi Nugro
Adhi Nugro

Written by Adhi Nugro

0 Followers

Hi, I’m Bagus Adhi Nugroho, a Backend Developer specializing in Python for Web Automation and Scraping.