Analisis Algoritma Insertion Sort, Merge Sort Dan Implementasinya Dalam Bahasa Pemrograman C++
Main Article Content
Abstract
This paper presents the study of implementation and performance in sorting process, using two different algorithms, namely Insertion Sort and Merge Sort. In the first stage, the two algorithms were implemented in C++ language to sort several numbers typed by a user. In the second stage, the source codes for those algorithms were modified to enable sorting randomly generated numbers with the amount as requested by the user. To find out how well they performed in sorting out the data, therefore in the last stage the two algorithms were tested to sort random numbers with predetermined amount ranges and the results were compared. From the experiments performed, merge sort algorithm had shown a better performance, particularly in a large number of data (> 10000). Insertion sort algorithm has the advantage in lower complexity algorithm, notably in the best case condition and since it does not use recursion routines in sorting process, hence it does not require as much storage space or memory as needed by merge sort algorithm.
Downloads
Article Details
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work
References
[2] Bingheng, W. 2008. Merge Sort. Dept. of Computer Science. Florida Institute of Technology. Florida, USA.
[3] Drozdek, A. 2001. Data Structures and Algorithms in C++. Brooks/Cole Thomson Learning. California. USA.
[4] Hibbler, R. 2008. Merge Sort. Dept. of Computer Science. Florida Institute of Technology. Florida, USA.
[5] Horman, T. H., Leiserson, C. E., Rivest, R. L., dan Stein, C. 2009. Introduction to Algorithms. The MIT Press. Cambridge. Massachusetts London. England.
[6] Horstmann, C. 2008. C++ for Everyone. Wiley Publishing. San Jose, USA.
[7] Karve, S. Insertion Sort Example. http://www.dreamincode.net/code/snippet279.htm. Diakses pada 18 Mei 2011.
[8] Kristanto, A. 2009. Algoritma dan Pemrograman dengan C++. Graha Ilmu. Yogyakarta.
[9] Liberty, J., Rao, S., Jones, B. 2008. Sams Teach Yourself C++ in One Hour a Day. Sams Publishing. Indiana, USA.
[10] MSDN. GetTickCount Function. http://msdn.microsoft.com/en-us/library/ms724408%28v=vs.85%29.aspx. Diakses pada 17 Mei 2011.
[11] Santosa, P.I. 2004. Struktur Data Menggunakan Turbo Pascal. Penerbit ANDI. Yogyakarta.
[12] Song, Q. 2008. Merge Sort Algorithm. Dept. of Computer Science. Florida Institute of Technology. Florida, USA.
[13] Yatini, I. dan Nasution, E. 2005. Algoritma dan Struktur Data. Graha Ilmu. Yogyakarta.