Professional Documents
Culture Documents
INTRODUCTION
I.1. Background
Algorithm is a set of instructions used to solve a problem. In general, algorithm is more
or less the same as a procedure that is done every day, such as a procedure for using the phone,
cooking procedures, and so on. In the field of computer science, algorithms are also used. For
example, a programmer needs an algorithm to create an effective and efficient program. There
are many algorithms used in the field, for example, the sorting sort algorithm.
Since the beginning of computing, this sort of problem has attracted serious research,
possibly because of the complexity of the settlement efficiently as well as the ease with which
we understand the statement. We take the example of the banking application. The app is
capable of displaying the list of active accounts. Almost all users on the system will select the
ascending list view sequentially for convenience in data retrieval. This is what keeps the
authors interested in discussing the sorting sort algorithm, especially the sorting sort algorithm.
1. CHAPTER I INTRODUCTION
a. Background
b. Writing Objective
c. Problem Domain
1
d. Writing Methodology
e. Writing Framework
a. Algorithm
b. What Is Data Structure
c. Sorting Sort Algorithm
a. Conclusion
b. Suggestion
5. BIBLIOGRAPHY
2
CHAPTER II
BASIC THEORY
II.1. Algorithm
The origin of the word algorithm comes from the name Abu Ja'far Mohammed ibn
Musa al-Khowarizmi, Persian scientist who wrotes the book al-jabr w'al-muqabala (Rules of
Restoration and Reduction) around the year 825 AD.
Sorting algorithm is an algorithm that puts elements of a list in a certain order. The
most-used orders are numerical order and lexicographical order. Efficient sorting is important
for optimizing the use of other algorithms (such as search and merge algorithms) that require
sorted lists to work correctly; it is also often useful for canonicalizing data and for producing
human-readable output. More formally, the output must satisfy two conditions:
1. The output is in nondecreasing order (each element is no smaller than the previous element
according to the desired total order);
2. The output is a permutation, or reordering, of the input.
4
CHAPTER III
PROBLEM ANALYSIS
Insertion Sort as the name implies this sorting inserts the data to where it should, one
by one each step. If the analogy in everyday life, Insertion Sort method is like when playing
cards (playing cards). Each turn, a player will pick up a card from the deck that has been shaken
/ random The idea of the algorithm of the insertion sort method can be analogous to the order
of cards, where if a card is moved according to its position, the other card will move backward
or forward according to the condition of the transfer of the card.
5
III.2 Implementation of Insertion Sort
From the description of the process of sorting / sorting the data above can be known
how the data move position from one index to another index in one array. For detail the above
sorting process, can be listened through the following simulation details.
Initial data: 5, 2, 4, 6, 1, 3
For each data sorting process, the data comparison starts from the second index (in this case i
= 1)
i = 1, x = 1; j = 0 i = 2, j = 1, x = 2
6
Process III:
I = 3, j = 2, x = 3
x <j à6 <5 - false = 2, 4, 5, 6, 1, 3 j = j-1 if a process is false, then the process will not proceed,
because automatically the data on the left is all ordered correct.
Process IV:
i = 4, j = 3, x = 4
Process V:
i = 5, j = 4, x = 5
package insertsortalgorithm;
System.out.println("====SEBELUM DIURUTKAN====");
7
System.out.println(data[a]+","); }
System.out.println("");
for(b=0; b<data.length;b++){
x=b;
for(j=b; j<data.length;j++)
x=j;
if (x!= b){
data[b]=data[x];
data[x]=data_sisip;
System.out.println("");
System.out.println("====SETELAH DIURUTKAN====");
System.out.println(data[i]+",");
8
Figure 3 System Out Print of Insertion Sort Java
Code
1. The number of operations required in finding the right position for the array elements.
2. For a large number of arrays this is not practical.
3. If the list is sequentially reversed so that every execution of the command must scan
and replace all parts before inserting the next element.
4. It takes O (n2) time on unordered data, so it does not fit in sorting of large amounts of
elements.
9
CHAPTER IV
CONCLUSION AND SUGGESTION
IV.1. Conclusion
Sorting is the most common operation on a table. There are many methods for
performing sorting of values with varying degrees of effectiveness for each case.
Insertion sort is a less complex sorting algorithm compared to bubble sort and selection sort
algorithms.
IV.1. Suggestion
Because this paper only discusses Insertion Sort algorithm theory in brief, it is
recommended that readers also have other references to get the complete material.
10
BIBLIOGRAPHY
1. http://www.academia.edu/11748619/Makalah_Algoritma_Sorting_Binary_Insertion_Sort
2. https://penamisterius.wordpress.com/2011/03/22/insertion-sort/
3. https://www.khanacademy.org/computing/computer-science/algorithms/insertion-
sort/a/insertion-sort
4. https://www.geeksforgeeks.org/insertion-sort/
11