A Comprehensive Analysis of Heap Sort Algorithm for Efficient Sorting Using C++ Programming Language

Authors

  • Rakhmat Purnomo Department of Informatics, Faculty of Computer Science, Universitas Bhayangkara Jakarta Raya
  • Tri Dharma Putra Department of Informatics, Faculty of Computer Science, Universitas Bhayangkara Jakarta Raya

DOI:

10.33395/sinkron.v10i3.16185

Abstract

Sorting is a need in the computational system including in big data analysis, database management systems, and real time applications. Heap sort is an efficient, comparison-based sorting algorithm that visualizes an array as a binary tree and transforms it into a heap data structure (usually a max heap for ascending sort). The algorithm repeatedly takes the largest element from the root of the heap, swaps it with the last element, and thus reduces the heap size until the heap is sorted The algorithm repeatedly takes the largest element from the root of the heap, swaps it with the last element, and thus reduces the heap size until the heap is sorted. The steps of this algorithm: a. Create Max Heap: Convert the input array into a Max Heap. b. Sort: Swap the root element (the largest element) with the last element, decrease the heap size by 1, and then convert the new root element into a heap. c. Repeat step 2 until the heap is empty. C++ is a known programming language. In this journal we use C++ programming to sort unsorted array. The code is presented in the details. One thorough step by step simulation is given in real data with heap sort and the program is run. The analysis is given by 7 data, namely:  [13, 10, 30, 2, 6, 7, 9]. The result is a presented with sorted heap sort. With 7 datasets to be analysed, it is concluded that 6 swaps happened.

GS Cited Analysis

Downloads

Download data is not yet available.

References

Ali, H., Nawaz, H., Maitlo, A., & Soomro, I. (2021). Performance Analysis of Heap Sort and Insertion Sort Algorithm. 9(May), 580–586.

Angga, R., Putra, B., Prihatmanto, A. S., & Yusuf, R. (2025). Heap Optimization in A * Pathfinding for Horror Games. 7(1), 924–940. https://doi.org/10.51519/journalisi.v7i1.941

Ayazuddin, R., & Scholar, G. (2025). A Comprehensive Study of Sorting Algorithm Performance Using Real- World Dataset Metrics A Comprehensive Study of Sorting Algorithm Performance Using Real-World Dataset Metrics. 0–12. https://doi.org/10.20944/preprints202509.2550.v1

Basir, R. R. (2020). Analisis Kompleksitas Ruang dan Waktu Terhadap Laju Pertumbuhan Algoritma Heap Sort, Insertion Sort dan Merge dengan Pemrograman Java. STRING: Satuan Tulisan Riset Dan Inovasi Teknologi, 5(2), 109–118. https://doi.org/http://dx.doi.org/10.30998/string.v5i2.6250

Fatmaluna, S. N., Aulia, N. G., Rahma, A., Aulia, S., & Pujiono, I. P. (2026). Comparison of Memory Efficiency and Computation Time of Bubble Sort , Insertion Sort , and Intro Sort Algorithms UsinComparison of Memory Efg the C ++ Programming Language. 5(2).

Haeupler, B., Hladík, R., Iacono, J., & Nov, D. S. (n.d.). Fast and Simple Sorting Using Partial Information.

Ilham, M. N., Setiawan, A. F., Kholifatun, I., & Aldiansyah, M. H. (2025). Comparative Analysis of Memory Performance and Processing Time of Five Sorting Algorithms Using C ++ Programming Language. 4(3).

Istiono, W. (2023). Heap-sort Algorithm on NPC.

No, I., & Wiredu, J. K. (2025). Available Online at www.ijarcs.info Optimizing Heap Sort for Repeated Values : A Modified Approach to Improve Efficiency in Duplicate-Heavy Data Sets. 15(6), 12–18.

Pujiono, I. P., Rachmawanto, E. H., Anisa, N., & Winarsih, S. (2025). Array Sorting Algorithm vs Algoritma Pengurutan Tradisional : Analisis Efisiensi Memori dan Waktu Array Sorting Algorithm vs Traditional Sorting Algorithm : Memory and Time Efficiency Analysis. 15(April), 47–59.

Purnomo, R., & Putra, T. D. (2023). Theoretical Analysis of Standard Selection Sort Algorithm. SinkrOn, 8(2), 666–673. https://doi.org/10.33395/sinkron.v8i2.12153

Putra, T. D., & Purnomo, R. (2025). Exchange Sort and Selection Sort Algorithms : Comparison and Theoretical Analysis. 7, 732–741. https://doi.org/10.30865/json.v7i2.9306

Rob, M. A., Hossen, Z., Hossen, K., Ali, M., & Roy, B. (2026). Wall-L merge sort : A tunable and adaptive sorting algorithm for diverse computing environments. 1–18. https://doi.org/10.1371/journal.pone.0341993

Sabah, A. S., Abu-naser, S. S., Helles, Y. E., Abdallatif, R. F., Samra, F. Y. A. A., Helmi, A., Taha, A., Massa, N. M., & Hamouda, A. A. (2023). Comparative Analysis of the Performance of Popular Sorting Algorithms on Datasets of Different Sizes and Characteristics. 7(6), 76–84.

Sorting, A. D. (2025). A Scalable Sorting Network Based on Hybrid Algorithms for. 19–21.

Sundaramoorthy, S., & Karunanidhi, G. (2025). A systematic analysis on performance and computational complexity of sorting algorithms.

Wibowo, F. R., Faisal, M., Magisterinformatika, P. S., Negeri, U., Maulana, I., & Ibrahim, M. (2024). Comparative Analysis of Sorting Algorithms : TimSort Python and Classical Sorting Methods. 07(01), 11–18.

Wiredu, J. K., & Baagyere, E. Y. (2025). A Novel Proximity-based Sorting Algorithm for Real-Time Numerical Data Streams and Big Data Applications. 186(71), 1–10.

Downloads


Crossmark Updates

How to Cite

Purnomo, R., & Putra, T. D. (2026). A Comprehensive Analysis of Heap Sort Algorithm for Efficient Sorting Using C++ Programming Language. Sinkron : Jurnal Dan Penelitian Teknik Informatika, 10(3), 1811-1819. https://doi.org/10.33395/sinkron.v10i3.16185

Most read articles by the same author(s)