Introducing 10 Algorithms, Knowledge and Learning Methods
What is an algorithm in the first place? An algorithm is a term used in various fields. However, in general, it is often used in programming, and there are multiple types.
What is an algorithm?
An algorithm is a term used to describe “procedures and calculation methods for solving problems.”
In other words, it concretely shows each step to reach the answer to the problem.
In other words, it’s like a route where anyone can reach the goal of the same answer by following the algorithm.
For example, algorithms are used in programming search engines, route guidance, and so on.
In today’s world, where a lot of information is overflowing, it is indispensable to provide the information requested by users quickly and accurately.
Reasons to be emphasized
Algorithms are of great importance not only in the world of programmers but also to the general public.
If you have the ability to logically solve any problem, you can efficiently return to a normal state.
Also, in program creation, creating an efficient program will lead to a reduction in the time it takes to achieve the purpose.
The algorithm has multiple steps for the purpose, so it is important to choose a more efficient method.
6 Types of Sorting Algorithms
The sorting algorithm is the most basic of the algorithms and “organizes and sorts” the data.
Specifically, it is an algorithm that is required when “arranging data according to certain rules such as ascending or descending order” when handling a large amount of data.
This sorting algorithm can be divided into 6 types.
- Bubble sort
- Selection sort
- Insertion sort
- Merge sort
I will explain each in detail.
1. Bubble sort
A bubble sort is a method of sorting the entire data while comparing the size of adjacent data.
It is often mentioned in algorithm learning because it requires less code to write and is easier to implement.
However, the number of scans is huge due to the large number of processing steps. In short, bubble sort should be used for small and simple data.
2. Selection sort
Selection sorting is an improved technique for bubble sorting. Specifically, it finds the maximum or minimum value in the data column and exchanges it for the first value.
Then look for the second value and place it next. It is a method to sort in order by repeating this. It is similar to bubble sort, but the biggest advantage is that it can be processed once.
3. Sorting by insertion
Insertion sort is a method of determining the order in which the retrieved values are arranged and inserting them one after another.
Specifically, check the numerical values one by one from the unaligned data and insert them at the appropriate positions in the aligned columns.
It is easier to understand than other sorting algorithms because it is the closest to the sorting done by humans.
Another feature is that the processing time depends on the quality of the sorted data.
4. Sort by merging
Merge sort is an algorithm that repeatedly divides the data to be sorted into two and then merges them while aligning them.
Then, the process of halving the data that has been halved is subdivided until the data becomes disjointed.
After that, the data that has been subdivided until it becomes a single substance is merged in order with the same elements.
Quicksort repeats grouping of “small values” and “large values” from the specified reference value. As you can see from the word “quick” in the name, it is an algorithm that allows fast sorting. Given given data and exchanged less often than other algorithms, fast sorting is possible.
Heapsort is performed using the characteristics of the binary heap tree. The feature is that the sorting processing speed is slow, but it can be sorted with a small amount of memory used.
The algorithm of heapsort is difficult when compared to other selection sorts. However, compared to merge sort, etc., it uses less memory and saves work area, resulting in efficient sorting. It is a good sorting algorithm to use when there is a lot of data.
Explaining Two Types of Searching Algorithms
1. linear investigation
Linear search is said to be the simplest algorithm.
The data in the array is compared in order from the beginning to check if it matches the data you are looking for.
Linear search can be applied to any list, but the disadvantage is that it is not very efficient.
However, it is a very important part in understanding the basics of the algorithm.
2. Binary investigation
Binary search is an algorithm that searches while narrowing down the data unit to half, depending on whether the value in the middle of the array is larger or smaller than the value to be searched .
It is more efficient than searching from the beginning of the array.
For example, suppose an array contains a total of 100 values, such as “2, 5, 10, 15,…, 150,…, 164”.
The value you want to search for is “150”.
At this time, it is more efficient to narrow down the search range by comparing intermediate values rather than searching in order from the front.
In addition, programming schools can efficiently learn such algorithms.
Explaining Two Types of Encryption Algorithms
1. Public-Key Method
Public-key cryptography is a method of encrypting and decrypting using two types of keys, a “public key” and a “private key . “
Specifically, the sender and receiver will have different keys from each other. Public-key cryptography is more secure because the process of decrypting it is more complicated.
For example, this public cryptosystem is used when you want to protect information from a third party.
2. Common Password Method
The common encryption method is a high-speed encryption method that encrypts files and data at a high level. Specifically, the same encryption is used when encrypting data and when decrypting it.
The feature is that it is difficult to derive the private key. For example, it is often used for electronic signatures.
3 Ways to Learn Algorithms
Books have a variety of content, so there are many choices, and you can choose according to the level you want to learn.
For example, if you don’t know anything about algorithms yet, you would choose a book that you can learn from, like an introduction to algorithms.
Also, if you know some algorithms, you can look for something like an evolution.
In other words, you can choose the learning method that suits you.
2. Programming Institutes
In programming, knowledge of algorithms is required.
Therefore, the programming school offers lectures to learn algorithms.
The advantages are as follows:
- Acquire knowledge in a short period of time.
- You can ask the instructor any questions.
- You can forcibly proceed with learning.
If you don’t have the ability to continue learning on your own, we recommend a programming school.
The biggest advantage of using a website is that it is inexpensive. Researchers and developers explain algorithms in an easy-to-understand manner for free on the Internet. However, not all of the information is correct, so incorporate learning on your website as a supplementary role.
Three Things to Learn with Algorithms
Specifically, learning the three basic structures will enable complex processing.
- Sequential processing: a structure in which one processing is executed and then the next processing is performed.
- Branch processing: A structure in which processing branches based on the circumstances.
- Iterative processing: A structure in which processing branches depending on conditions.
By learning these structures, even people with little programming experience can create practical programs.
2. A flowchart
Flowcharts are called flow charts and are used to visually understand the flow of things, such as in algorithms.
In programming, we use meaningful graphic symbols to write code that flows from top to bottom.
There are rules for how to write.
- “Sequential structure” is written in a rectangle, and each process is connected by an arrow.
- “Branch structure” writes the condition for branching within the frame of the diamond.
- “Repeat structure” is written in a hexagon like a trapezoid, and each process is connected by an arrow.
When ending the loop, make it the opposite of the first trapezoid.
3. Amount calculated
This is because in programming, it is always necessary to consider “complexity” in order to process at high speed using a small number of algorithms.
“Computational complexity”, which is an index of the cost of calculation, is “spatial complexity” and “time complexity”.
Specifically, “spatial complexity” is the amount of memory used when executing a program.
“Time complexity” is the processing time of the program. Calculate the number of instructions required to complete the process.