Analisis Kompleksitas Waktu Eksekusi Algoritma Insertion Sort dan Selection Sort pada Berbagai Skenario Distribusi Data
DOI:
https://doi.org/10.24252/shift.v6i2.294Keywords:
Data Distribution, Insertion Sort, Python, Selection SortAbstract
Understanding the efficiency of sorting algorithms cannot be reduced merely to theoretical analysis; rather, it depends heavily on interpreter execution within modern computing environments. Although Insertion Sort and Selection Sort share the same theoretical complexity of , their empirical performance exhibits significant divergence due to initial data characteristics and memory allocation mechanisms. This research evaluates the interaction between data structure distributions and the CPython interpreter's execution overhead on both algorithms. The experiments were conducted in an isolated Google Colab environment using a high-resolution timing instrument on dataset sizes ranging from up to numerical elements. The tests were replicated through 10 independent iterations across three distribution scenarios: random, ascending, and descending. Quantitative analysis demonstrates that the O(n^2) label does not apply uniformly in the empirical realm. At , Insertion Sort achieved its highest efficiency at 1.24 ms in the ascending case, yet suffered a drastic performance collapse, reaching 3,842.60 ms in the descending case. Conversely, Selection Sort exhibited a rigid latency resistance, remaining constant in the range of 1,950–2,150 ms across all scenarios, completely unaffected by the advantages of pre-sorted data. This extreme performance disparity in the worst-case scenario is proven to not stem purely from algorithmic computation, but rather from the severe overhead of reference counting and Python's dynamic memory management when Insertion Sort executes massive index shifts (memory writes), as opposed to Selection Sort which minimizes memory mutations.
Downloads
References
M. I. Ali, R. D. Fardiarsyah, L. Shodik, F. Z. D. Kinanti, dan I. P. Pujiono, "Analisis Komparatif Efisiensi Memori dan Waktu Komputasi pada 8 Algoritma Sorting menggunakan C++," LogicLink: Journal of Artificial Intelligence and Multimedia in Informatics, vol. 2, no. 1, hal. 1-17, 2025.
I. P. Pujiono, E. H. Rachmawanto, dan N. A. S. Winarsih, "Array Sorting Algorithm vs Algoritma Pengurutan Tradisional: Analisis Efisiensi Memori dan Waktu," Jurnal Manajemen Informatika (JAMIKA), vol. 15, no. 1, hal. 47-59, 2025.
H. Y. Tumanggor, R. M. F. Lubis, M. Sianturi, dan R. G. Purba, "Metode Algoritma Bubble Sort, Algoritma Merge Sort Dan Algoitma Quick Sort Dalam Pengujian Perbandingan Proses," JUTISAL (Jurnal Teknik Informatika Komputer Universal), vol. 2, no. 2, hal. 1-10, 2022.
Y. A. Sandria, M. R. A. Nurhayoto, L. Ramadhani, R. S. Harefa, dan A. Syahputra, "Penerapan Algoritma Selection Sort untuk Melakukan Pengurutan Data dalam Bahasa Pemrograman PHP," Hello World Jurnal Ilmu Komputer, vol. 1, no. 4, hal. 190-194, 2022.
P. D. Setyorini, L. T. Azzahro, R. A. Yuniar, dan I. P. Pujiono, "Pengembangan Alat Bantu Pembelajaran Sorting Algorithm Berbasis Visual Console C++," Jurnal Riset dan Aplikasi Mahasiswa Informatika (JRAMI), vol. 6, no. 3, hal. 685-694, 2025.
P. Rahayuningsih, "Analisis Perbandingan Kompleksitas Algoritma Pengurutan Nilai (Sorting)," Jurnal Evolusi, vol. 4, no. 2, hal. 64-75, 2016.
R. Putra, dkk., "Analisis Kinerja Algoritma Bubble Sort, Selection Sort, dan Insertion Sort Menggunakan Python pada Data Mahasiswa," JIPTI (Jurnal Ilmiah Penelitian Teknologi Informasi), vol. 6, no. 2, hal. 1-8, 2025.
A. H. Saptadi dan D. W. Sari, "Analisis Algoritma Insertion Sort, Merge Sort Dan Implementasinya Dalam Bahasa Pemrograman C++," Jurnal INFOTEL, vol. 4, no. 2, hal. 10-17, 2012.
S. A. Saputro dan F. N. Khasanah, "Teknik Selection Sort dan Insertion Sort dalam Pengurutan Data," Jurnal RESTI (Rekayasa Sistem dan Teknologi Informasi), vol. 2, no. 1, hal. 15-20, 2018.
D. R. Poetra, "Performa Algoritma Bubble Sort dan Quick Sort pada Framework Flutter dan Dart SDK," JATISI (Jurnal Teknik Informatika dan Sistem Informasi), vol. 9, no. 2, hal. 806-816, 2022.
M. A. P. Siregar, dkk., "Analisis Kebutuhan Waktu Algoritma Insertion Sort, Merge Sort, dan Quick Sort dengan Kompleksitas Waktu," Jurnal Informatika, vol. 5, no. 1, hal. 1-8, 2018.
I. P. Pujiono, M. R. Kamal, A. Prayogi, C. A. Sari, dan R. M. Ikhsanuddin, “Algoritma Counting Sort vs Algoritma Pengurutan Modern: Analisis Efisiensi Memori dan Waktu Komputasi,” Jurnal Informatika dan Teknik Elektro Terapan, vol. 13, no. 3, 2025, doi: 10.23960/jitet.v13i3.6657.
S. N. Fatmaluna, N. G. Aulia, A. Rahma, S. Aulia, dan P. Pujiono, “Journal of Artificial Intelligence and Engineering Applications Comparison of Memory Efficiency and Computation Time of Bubble Sort, Insertion Sort, and Intro Sort Algorithms Using the C++ Programming Language,” 2026. [Online]. Available: https://ioinformatic.org/
S. Zahwa, N. D. Amelia, R. Nafila, R. A. Putri, dan P. Pujiono, “Jurnal Restikom: Riset Teknik Informatika dan Komputer Perbandingan Efisiensi Memori dan Waktu Komputasi pada Algoritma Rekursif dan Iteratif dalam Operasi Pengurutan di C++,” vol. 7, no. 1, hal. 123–136, 2025. [Online]. Available: https://restikom.nusaputra.ac.id
T. Carneiro, R. V. M. Da Nobrega, T. Nepomuceno, G. Bin Bian, V. H. C. De Albuquerque, dan P. P. R. Filho, “Performance Analysis of Google Colaboratory as a Tool for Accelerating Deep Learning Applications,” IEEE Access, vol. 6, hal. 61677–61685, 2018, doi: 10.1109/ACCESS.2018.2874767.
W. Mckinney, “Data Structures for Statistical Computing in Python,” 2010.
M. Li, “Balancing Performance Trade-offs in Modern Sorting Methodologies,” 2024.
J. Golonka dan F. Krużel, “Empirical Evaluation of Unoptimized Sorting Algorithms on 8-Bit AVR Arduino Microcontrollers,” Sensors, vol. 26, no. 1, 2026, doi: 10.3390/s26010214.
N. A. R. S. Nasution, M. N. A. Surbakti, dan I. P. Sari, "Analisis Kompleksitas Diantara Algoritma Insertion Sort dan Selection Sort dan Diimplemntasikan dengan Bahasa Pemograman Java," InfoTekJar: Jurnal Nasional Informatika dan Teknologi Jaringan, vol. 8, no. 1, hal. 6-9, 2023, doi: 10.30743/infotekjar.v8i1.9641.
A. Kusumaningrum, "Perbandingan Kecepatan Antara Selection Sort, Insertion Sort, dan Bubble Sort," Jurnal Teknomatika, vol. 6, no. 2, hal. 1-8, 2013.
E. Alexander, "I Implemented Every Sorting Algorithm in Python — The Results Nobody Talks About (Benchmarked on CPython)," Python Sorting Benchmarks, 2025
D. Grigorov, "Why Performance Matters in Python Development," JetBrains Engineering Blog, 2025.
M. A. Ala'Anzy, Z. Mazhit, and A. F. Ala'Anzy, "Comparative Analysis of Sorting Algorithms: A Review," 2024 11th International Conference on Soft Computing & Machine Intelligence (ISCMI), pp. 88-100, 2024.
A. Zade, V. Mandloi, "Bilateral Selection Sort," International Journal for Research in Applied Science & Engineering Technology (IJRASET), vol. 8, no. 7, pp. 230-236, 2020
J. Bodnar, "Python time.perf_counter() for Microbenchmarking," ZetCode Documentation, 2023
Downloads
Published
Issue
Section
Categories
License
Copyright (c) 2026 Revani Zahra Afifah, Dina Nur Vidiana, Rizki Amalia, Cahya Putri Jelita, Imam Prayogo Pujiono

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.




