You are on page 1of 17

Information Search and Analysis Skills

(ISAS)

IMPLEMENTATION OF COUNTING SORT WITH DATA OF DROP OUT


SCHOOL IN INDONESIA

Faculty:

Muhammad Riza Iqbal Latief, S.T.

Written By:

Andro Rizky Adwityo

Setyo Aji Wibowo

Continuing Education Center for Computing and Information Technology

Faculty of Engineering, University Indonesia

Depok 16424
PREFACE

Praise the presence of Allah SWT for his permission, so that the author can complete the
isas with the title ”Implementation and Analysis of aCounting Sort". Appreciation and thanks to
the writer give to Mr. Muhammad Riza Iqbal Latief, S.T. as a faculty of class 2 NAP 1 and other
teaching staff who always help. Thank you also to fellow students who have supported and also
thank you for being a colleague in education at CCIT-FTUI.

The task of this isas the author made with the aim to complete the assessment of learning
in CCIT-FTUI. With this paper the author hopes to provide benefits to readers and listeners so as
to increase knowledge and insight.

Finally, the writer realizes that this thesis is far from perfect. Therefore, the authors
request suggestions and criticisms that are constructive for perfection and hopefully useful for us
all. Amin.

Depok, May 2020

Author

ii
TABLE OF CONTENTS

PREFACE ................................................................................................................................ ii
TABLE OF CONTENTS ........................................................................................................ iii
TABLE OF FIGURE .............................................................................................................. iv
CHAPTER I INTRODUCTION............................................................................................ 1
1.1 Background ............................................................................................................... 1
.2 Writing Objective ...................................................................................................... 1
.3 Problem Domain ...................................................................................................... 1
.4 Writing Methodology ................................................................................................ 1
.5 Writing Framework ................................................................................................... 2
CHAPTER II BASIC THEORY ............................................................................................ 3
.1 Definition of Algorithm ............................................................................................ 3
.2 History of Algorithm ................................................................................................. 3
.3 Type of Algorithm .................................................................................................... 4
.4 Definition of Sorting Algorithm ............................................................................... 5
.5 Type of Sorting Algorithm ........................................................................................ 5
.6 Definition of Counting Sort....................................................................................... 6
.7 Characteristic of Counting Sort ................................................................................ 7
.8 Counting Sort for Sorting Data of Number Drop Out School .................................. 7
.9 Definition and Factors of Drop Out School .............................................................. 7
CHAPTER III PROBLEM ANALYSIS ............................................................................... 8
.1 Implementing of Counting Sort ................................................................................ 8
.2 How to Counting Sort Work...................................................................................... 8
.3 Efficiency of Counting Sort....................................................................................... 9
.4 Counting Sort for Sorting Number of Drop Out School .......................................... 10
CHAPTER IV CONCLUSION AND SUGGESTION ....................................................... 12
.1 Conclusion ................................................................................................................ 12
.2 Suggestion ................................................................................................................. 12

BIBILOGRAPHY ................................................................................................................... 13

iii
TABLE OF FIGURE

Figure 3.1 First Step of Counting Sort Work ............................................................................ 8

Figure 3.2 Second Step of Counting Sort Work ........................................................................ 8

Figure 3.3 Third Step of Counting Sort Work ........................................................................... 8

Figure 3.4 Fourth Step of Counting Sort Work ......................................................................... 8

Figure 3.5 Finally Step of Counting Sort Work ........................................................................ 9

iv
CHAPTER I

INTRODUCTION

.1 Background
Algorithm is a collection of commands that have a very large use for the community.
The algorithm is usually used as a collection of commands to solve a problem. In
mathematics and computer science, the meaning of an algorithm is a step-by-step procedure
for calculation. Algorithms are used for calculation, automatic reasoning, and data
processing. One of the most important sorting algorithms in information technology is
Counting Sort.
Counting sort is a sorting technique by counting the number of occurrences of each
data in the array. In this algorithm we have to create a container array to store the number of
occurrences of data where the size of the array must be a range of numbers that can be input
by the user. This algorithm can sort data from large to small (Ascending) and small to large
(Descending). This algorithm is not suitable for large data sets.
In the process, the counting sort algorithm technique involves counting or calculating
data numbers and array indexes. The calculation includes addition and subtraction.
Therefore, this sorting algorithm technique is called Counting Sort. This algorithm was
created by Harold H. Seward in 1954.
Therefore in this ISAS, we want to analyze the implementation of Counting Sort. So
that readers can better understand about Counting Sort.
.2 Writing Objective
The purpose of writing a paper entitled "Implementation and Analysis of Counting
Sort" is to analyze and explain the Implementation of Counting Sort so as to increase reader
knowledge.
.3 Problem Domain
In this paper, we will discuss the Function and Implementation of Counting Sort.
.4 Writing Methodology
The method we use to write this paper is to collect data from online articles, from
online books, and research.

v
.5 Writing Framework
 Chapter I (Introduction) :
In Chapter we will discuss the background of the problem, Writing Objective, the
purpose of the problem, Problem Domain, the Writing Methodology and the Writing
Framework.
 Chapter II (Basic Theory) :
In Chapter II, will discuss about definition, history, type of algorithm.
 Chapter III (Problem Analysis) :
Discussion of the chosen topic, more detailed explanation, and profound. As well as
solutions to the problems discussed in Chapter 1.
 Chapter IV (Conclusion and Suggestion) :
Contains conclusions from the author about the experience gained after explaining in
Chapter 3.

vi
CHAPTER II

BASIC THEORY

1.1 Definition of Algorithm


In mathematics and computing, algorithms are collections of commands to solve a
problem. This collection of commands is usually translated by the computer in stages from
the first to the last sequentially. Problems that are related here can be a variety of problems
as long as the problem has preliminary condition criteria that must be met before running
the algorithm [ CITATION Ham20 \l 1033 ].
The word algorithm comes from the Latinization of the name of a mathematician
from Al-Khawārizmi (living around the 9th century), as stated in his 12th-century Latin
translation "Algorithmi de numero Indorum". Initially the word algorithm is a term that
refers to arithmetic rules to solve problems using Arabic numerical numbers (actually from
India, as written in the title above). In the 18th century, this term developed into an
algorithm, which included all procedures or sequences that were clear and needed to solve
a problem [ CITATION Ham20 \l 1033 ].
.2 History of Algorithm
Mathematical historians believe that the word algorithm comes from the name of the
author of the book as well as the famous Arab mathematician, Abu Ja'far Muhammad Ibn
Musa Al-Khuwarizmi (770-840). Some references write Abu Abdullah Muhammad Ibn
Musa Al-Khawarizrni [ CITATION Kan17 \l 1033 ].
Westerners recite Al-Khuwarizmi with an algorithm. Either because Al-Khuwarizmi
was a clever algorithm, then henceforth known as algorithmism as a definition for the step
of solving a problem that produced a solution by westerners [ CITATION Kan17 \l 1033 ].

Al-Khuwarizmi was born in Khwarizm (kheva), a city located south of the Oxus
River (now Uzbekistan). When he was little, he moved with his parents south of the city
of Baghdad (Iraq). One of Al-Khuwarizmi's famous books is Kitab Al Jabar Wal-
Muqabala which means "The book of restoration and reduction." From the title of the
book, too, we get the word "Algebra" which is now a branch of mathematics. Another
source of writing algorithms is a special method that is appropriate and consists of a series

vii
of steps that are structured and mathematically written, which will be done to solve a
problem with the help of a computer. Like a strong building has a good frame structure.
Likewise, a good program or application must also be composed by a good programming
structure. The technique of structuring the program is called an algorithm [ CITATION Kan17
\l 1033 ].

.3 Type of Algorithm
There are various kinds of algorithms that are often used in the programming world, some
examples of algorithm are:
1. Hashing Algorithms
Hashing is a string of characters into a value that represents the original string.
According to the language, hash means to chop off and then combine.
2. Link Analysis Algorithms
The link analysis algorithm is based on two assumptions, namely a link submitted by
someone and a page quoted by a particular page and may have the same topic. In
general, in the calculation of link analysis, the web is considered as the smallest unit
in web graph development. Thus, every link on each web will be considered the
same, regardless of the location of the link.
3. Search Algorithms
Searching is a very important process in data processing. The search process is
finding certain values or data in a set of data of the same type. Search algorithm
(search algorithm) is an algorithm that accepts a keyword (key), then there are
certain steps to look for records with that keyword.
4. Dynamic Programming Algorithms
Dynamic Programming is one of the algorithm design techniques that was developed
to solve very complex problems by breaking down these problems into many sub-
problems.
5. Sort Algorithms
Sort algorithm (Sort Algorithms) is a collection of steps systematically or
sequentially to obtain the desired results. One example of the algorithm for this step
is sorting. Sorting can be defined as sorting a number of data based on certain
values.
viii
That are some example of algorithm type. And in this isas the author will depending
about sorting algorithms.

.4 Definition of Sorting Algorithm


Sorting algorithm is a collection of systematic steps or sequentially to obtain the
desired results. One example of the algorithm for this step is sorting. Sorting can be defined
as sorting a number of data based on certain values. Sorting can be done from the smallest
value to the largest value (ascending) or vice versa.
Sorting can be divided into two, namely comparison sort (bubble sort, selection sort,
insertion sort, merge sort, quick sort) and non-comparison Sort (Radix Sort, Counting
Sort). Comparison Sort / sorting is an algorithm that in the sorting process makes
comparisons between data. Non-comparison Sort / sorting without comparison is a sorting
algorithm which in the process does not make comparisons between data [ CITATION Din13 \l
1033 ] :
1. Non comparison sort sorting time is faster than comparison sort;
2. Non comparison sort algorithms do not require a comparator to sort elements;
3. Non comparative sort algorithms cannot be used to sort anything other than
integers.
.5 Type of Sorting Algorithm
Sort algorithm can be divided into two types, namely:
A. Comparison Sort
1. Bubble sort
Bubble Sort is a method of sorting data by exchanging data right next to it
continuously until there is no change in one iteration. If there are no changes, the
data is sorted.
2. Insertion Sort
Insertion Sort is a method of sorting data by placing each data element in its
position by making comparisons. This method is the same as sorting a card, where
if a card is moved its position, then the other card will shift according to the
conditions of the card transfer.

ix
3. Selection Sort
Selection Sort is a combination of sorting and searching. This method is very
simple because every process will look for the elements that have not been sorted
the smallest (ascending) or largest (descending) which will be exchanged to the
right position in the array.

4. Marge Sort
In this algorithm the data set is divided into sub-groups which are then sorted
separately, and then rejoined by the merging method. In reality this algorithm
performs the sorting method of merge sort also to sort the subset of data, or in other
words, the sorting is done recursively.
5. Quick Sort
Quick sort is a highly efficient sorting algorithm and is based on partitioning of
array of data into smaller arrays. A large array is partitioned into two arrays one of
which holds values smaller than the specified value, say pivot, based on which the
partition is made and another array holds values greater than the pivot value.
Quicksort partitions an array and then calls itself recursively twice to sort the two
resulting subarrays. This algorithm is quite efficient for large-sized data sets as its
average and worst-case complexity are O(n Log n) and image.png(n2), respectively.
B. Non-Comparison Sort
1. Counting sort
Counting Sort is a sorting technique by counting the number of occurrences of each
data in the array. In this algorithm we have to create a container array to store the
number of occurrences of data where the size of the array must be a range of
numbers that can be input by the user.
2. Radix sort
Radix Sort is a sorting technique that sorts the elements by first grouping the
individual digits of same place value. Then, sort the elements according to their
increasing/decreasing order.
.6 Definition of Counting Sort

x
Counting sort is a sorting technique by counting the number of occurrences of each
data in the array. In this algorithm we have to create a container array to store the number
of occurrences of data where the size of the array must be a range of numbers that can be
input by the user. This algorithm can sort data from large to small (ascending) and small to
large (descending). This algorithm is not suitable for large data sets.
In the process, the counting sort algorithm technique involves counting or
calculating data numbers and array indexes. The calculation includes addition and
subtraction. Therefore, this sorting algorithm technique is called Counting Sort. This
algorithm was created by Harold H. Seward in 1954.
.7 Characteristic of Counting Sort
1. Efficient to do the sorting because it does not compare with other data;
2. The condition for this sorting to be carried out is knowing the range of values of the
data;
3. The data to be sorted must also be an integer (integer);
4. Using arrays;
.8 Counting Sort for Sorting Data of Number Drop Out School
In this paper, we will use Counting Sort to sort numbers from data on the number of
students dropping out of school in Indonesia. We chose the number of high school dropout
students to sample the discussion.
.9 Definition and Factors of Drop Out School
According to Gunawan [ CITATION Ano203 \l 1033 ] . Dropping out of school is a
predicate given to former students who are unable to complete an education level, so they
cannot continue their studies to the next level of education. For example, a community
member or child who only attends elementary school until fifth grade, is called primary
school dropout.
There are many factors that cause children to drop out of school. There are factors
that originate from within (internal) students themselves, such as laziness and self
incapacity. There are also factors that come from outside (external) students, such as lack
of funds and educational facilities.

xi
CHAPTER III

PROBLEM ANALYSIS

.1 Implementing of Counting Sort


Counting sort is a sorting technique by counting the number of occurrences of each
data in the array. This algorithm can sort data from large to small (Ascending) and small to
large (Descending). This algorithm is not suitable for large data sets [ CITATION Fid20 \l 1033
].
Counting sort is used when[ CITATION Ano202 \l 1033 ] :
 The are smaller integers of multiple counts
 Linear complexity is the need.
.2 How to Counting Sort Work
This is the step of Counting Sort works[ CITATION Ano202 \l 1033 ] :
1. Find out the maximum element (let it be max) from the given array .

Figure 3.1 First Step of Counting Sort Work (source: www.programiz.com )


2. Initialize an array of length max+1 with all elements 0. This array is used for storing the
count of the elements in the array.

Figure 3.2 Second Step of Counting Sort Work (source: www.programiz.com )


3. Store the count of each element at their respective index in count array. For example: If
the count of element “4” occurs 2 times then 2 is stored in the 4th position in the count
array. If element “5” is not present in the array, then 0 is stored in 5th position.

Figure 3.3 Third Step of Counting Sort Work (source: www.programiz.com)

xii
4. Store cumulative sum of the elements of the count array. It helps in placing the
elements into the correct index. If there are x elements less than y, its position should
be at x-1. For example: In the array below, the count of 4 is 6. It denotes that there are 5
elements smaller than 4. Thus, the position of 4 in the sorted array is 5th.

Figure 3.4 Fourth Step of Counting Sort Work (source: www.programiz.com)


5. Find the index of each element of the original array in count array. This gives the
cumulative count. Place the element at the index calculated.

Figure 3.5 Finally Step of Counting Sort Work (source: www.programiz.com)

6. After placing each element at its correct position, decrease the its count by one.

.3 Efficiency of Counting Sort

Counting Sort is quite effective for finding data because counting sort does not
compare one data with another data so it does not take much time to count data.

xiii
.4 Counting Sort for Sorting Number of Drop Out School

In this section we will practice the sort calculation method to sort the data on high school
dropout rates in 2018-2019 in Indonesia, we use the Java programming language.

xiv
The Result of Pseudocode :

We will now look at the Java Program for Counting sort functions. The first step is to
collect data on the number of dropouts in Indonesia. After that, we input the data in the form of
numbers into the int [] testArray = {....}. Then we execute and will automatically be sorted from
the smallest to the largest. From this data, we know that the smallest dropout rate is in North
Kalimantan and the largest dropout rate is in West Java.

xv
CHAPTER IV

CONCLUSION AND SUGGESTION

.1 CONCLUSION

Counting sort is a sorting technique by counting the number of occurrences of each


data in the array, but if the amount of data needed is large, it requires a lot of arrays as
well. This algorithm can sort data from large to small (ascending) and small to large
(descending).

.2 SUGGESTION

From the results of this discussion, we suggest that to sort a data you can use the
Counting Sort Algorithm because it takes a short time, but judging from the amount of
data, if the amount of data is large it requires a lot of arrays as well.

xvi
BIBLIOGRAPHY

[1] H. Hartono, "Adoc," [Online]. Available: https://adoc.tips/bab-2-landasan-teori-perintah-untuk-


menyelesaikan-suatu-masa.html. [Accessed 26 February 2020].

[2] K. Informasi, "Kanal Informasi," 11 May 2017. [Online]. Available:


https://www.kanalinfo.web.id/pengertian-algoritma-dan-sejarahnya. [Accessed 27 February 2020].

[3] Dinahaq, "Ilmu Dunia Informatika," 23 January 2013. [Online]. Available:


http://ilmuduniainformatika.blogspot.com/2013/01/algoritma-sorting.html. [Accessed 6 March
2020].

[4] Anonym, "Digital Repository Universitas Negeri Lampung," [Online]. Available:


http://digilib.unila.ac.id/21014/15/BAB%20II.pdf. [Accessed 7 May 2020].

[5] S. M. Fidelson Tanzil, "Binus," Binus University, [Online]. Available:


https://socs.binus.ac.id/2019/12/27/counting-sort/. [Accessed 28 February 2020].

[6] Anonym, "Programiz," Parewa Labs Pvt, [Online]. Available:


https://www.programiz.com/dsa/counting-sort. [Accessed 28 February 2020].

xvii

You might also like