Simulation and Implementation of Insertion Sort Algorithm to Sort Positive Integers Using C++ Programming Language
DOI:
https://doi.org/10.58776/ijitcsa.v4i3.278Keywords:
Algorithm, Ascending, C , Descending, Integer, InsertionAbstract
Sorting is the process of systematically arranging data, initially in an unordered state. That is according to specific rules or criteria (such as numerical or alphabetical order). This process is essential in many fields and applications, including computer science, statistics, and data management, as it facilitates the searching, analysis, and further processing of information. Insertion algorithm is a good algorithm and used in many applications. In this implementation and simulation six figures of positive integers to be sorted are used, namely 30, 2, 5, 7, 11, 1. Each with five processes. After implementation in ascending order there were nine swaps, and in descending order there were only six swaps. The implementation is performed with C++ Programming Language. Two pseudo codes are given, one for ascending and one for descending. The results were a successful implementation and simulation of C++. Screenshot are given to prove that the programs are running smoothly
References
A. S. Sabah et al., “Comparative Analysis of the Performance of Popular Sorting Algorithms on Datasets of Different Sizes and Characteristics,” vol. 7, no. 6, pp. 76–84, 2023.
F. R. Wibowo, M. Faisal, P. S. Magisterinformatika, U. Negeri, I. Maulana, and M. Ibrahim, “Comparative Analysis of Sorting Algorithms : TimSort Python and Classical Sorting Methods,” vol. 07, no. 01, pp. 11–18, 2024.
A. Ghofur, J. Nazila, N. Holidiyah, and S. Kholifah, “Penerapan Algoritma Insertion Sort Pada Aplikasi Pengolahan Data Mahasiswa Menggunakan Java Di Fakultas Sains Dan Teknologi Prodi Teknologi Informasi,” vol. 4, no. 01, pp. 12–19, 2025, doi: 10.58812/ejpcs.v4i01.
M. Rizky, S. Barokah, T. Saputra, and T. Sutabri, “Perbandingan Kinerja Algoritma Bubble Sort dan Insertion Sort dalam Pengurutan Data Penjualan UMKM,” vol. 5, no. 1, pp. 184–195, 2025.
B. Elshqeirat, M. Altarawneh, and A. Aloqaily, “Enhanced Insertion Sort by Threshold Swapping,” vol. 11, no. 6, pp. 471–476, 2020.
R. Purnomo and T. D. Putra, “Theoretical Analysis of Standard Selection Sort Algorithm,” SinkrOn, vol. 8, no. 2, pp. 666–673, 2023, doi: 10.33395/sinkron.v8i2.12153.
T. D. Putra and R. Purnomo, “Exchange Sort and Selection Sort Algorithms : Comparison and Theoretical Analysis,” vol. 7, pp. 732–741, 2025, doi: 10.30865/json.v7i2.9306.
S. N. Fatmaluna, N. G. Aulia, A. Rahma, S. Aulia, and I. P. Pujiono, “Comparison of Memory Efficiency and Computation Time of Bubble Sort , Insertion Sort , and Intro Sort Algorithms UsinComparison of Memory Efg the C ++ Programming Language,” vol. 5, no. 2, 2026.
M. N. Ilham, A. F. Setiawan, I. Kholifatun, and M. H. Aldiansyah, “Comparative Analysis of Memory Performance and Processing Time of Five Sorting Algorithms Using C ++ Programming Language,” vol. 4, no. 3, 2025.
I. P. Pujiono, E. H. Rachmawanto, N. Anisa, and S. Winarsih, “Array Sorting Algorithm vs Algoritma Pengurutan Tradisional : Analisis Efisiensi Memori dan Waktu Array Sorting Algorithm vs Traditional Sorting Algorithm : Memory and Time Efficiency Analysis,” vol. 15, no. April, pp. 47–59, 2025.
F. R. Hakim, H. S. Ismallah, M. L. Firdaus, P. Studi, T. Informatika, and P. N. Pontianak, “PENERAPAN ALGORITMA INSERTION SORTING TERHADAP,” vol. 1, no. 2, pp. 332–341, 2024.
J. Inovasi, B. Digital, W. Azizah, and S. M. Siregar, “Penerapan Algoritma Insertion Sort dalam Pengurutan Data Menggunakan Bahasa Pemrograman PHP,” vol. 1, no. 3, 2026.
Z. Sitorus, D. Prayogi, M. A. Rizko, A. G. Suteja, and M. Raihan, “Implementation of the Insertion Sort Algorithm to Sort Positive Integers in Ascending Order Using Flowgorithm,” vol. 1, no. 3, pp. 323–328, 2024, doi: 10.30596/jitcse.
H. Ali, H. Nawaz, A. Maitlo, and I. Soomro, “Performance Analysis of Heap Sort and Insertion Sort Algorithm,” vol. 9, no. May, pp. 580–586, 2021.
R. Ayazuddin and G. Scholar, “A Comprehensive Study of Sorting Algorithm Performance Using Real- World Dataset Metrics A Comprehensive Study of Sorting Algorithm Performance Using Real-World Dataset Metrics,” pp. 0–12, 2025, doi: 10.20944/preprints202509.2550.v1.
R. R. Basir, “Analisis Kompleksitas Ruang dan Waktu Terhadap Laju Pertumbuhan Algoritma Heap Sort, Insertion Sort dan Merge dengan Pemrograman Java,” STRING Satuan Tulisan Ris. dan Inov. Teknol., vol. 5, no. 2, pp. 109–118, 2020, doi: http://dx.doi.org/10.30998/string.v5i2.6250.
T. B. Yulianto, A. J. Taufiq, and A. Suyadi, “Rancang Bangun Pengaturan Intensitas Sinar Uv (Ultraviolet) Dengan Mikrokontroler PIC Untuk Tanaman,” J. Ris. Rekayasa Elektro, vol. 1, no. 1, pp. 54–70, 2019, doi: 10.30595/jrre.v1i1.4929.
D. B. P. C, “Analisis algoritma insertion sort, merge sort dan implementasinya dalam bahasa pemrograman c++,” vol. 4, no. November, pp. 10–17, 2012.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 Rakhmat Purnomo, Tri Dharma Putra

This work is licensed under a Creative Commons Attribution 4.0 International License.
Attribution 4.0 International
You are free to:
- Share — copy and redistribute the material in any medium or format for any purpose, even commercially.
- Adapt — remix, transform, and build upon the material for any purpose, even commercially.
- The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
- Attribution — You must give appropriate credit , provide a link to the license, and indicate if changes were made . You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation .
No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.


