|
Ijrar research Journal© 2020 IJRAR September 2020, Volume 7, Issue 3 www.ijrar.org (IJRAR19L2026© 2020 IJRAR September 2020, Volume 7, Issue 3 www.ijrar.org (
E-ISSN 2348-1269, P- ISSN 2349-5138
)
IJRAR19L2026
International Journal of Research and Analytical Reviews (IJRAR)
www.ijrar.org
117
Fig. 3 Insertion Sort Code
Fig. 3.1 Example of Insertion Sort [11]
D.
Merge Sort
Merge Sort is worked with the basis of Divide and Conquer algorithm. It splits the input array into two bisects, calls itself for
the two bisects and merges two sorted bisects.
1. Divide Step:
If a given array Arr has zero or one element, simply return; if previously sorted. Otherwise, split Arr [x ... z]
into two secondary arrays Arr [x ... z] and A [y + 1 ... z], each containing about parts of the elements of Arr [x ... z]. That is, y is
the intermediate point of Arr [x ... z].
2. Conquer Step:
Now Sorting the two small arrays Arr [x ... z] and Arr [y + 1 ... z] recursively by using conquer
3. Combine Step:
After all, we have to Merge the back of the element in Arr [x ... z] by merging the two sorted small arrays
Arr [x ... z] and Arr [y + 1 ... z] into a sorted series. To achieve this pace, will identify a procedure MERGE (Arr, x, y, z).
Merge sort algorithm [8][9] used in the experiments below was described by C++ language as shown in fig 4:
© 2020 IJRAR September 2020, Volume 7, Issue 3 www.ijrar.org (
E-ISSN 2348-1269, P- ISSN 2349-5138
)
IJRAR19L2026
International Journal of Research and Analytical Reviews (IJRAR)
www.ijrar.org
118
Fig. 4 Merge Sort Code
Fig. 4.1 Example of Merge Sort [12]
E.
Quick Sort
Quick sort is one of the fastest sorting algorithms which is the part of many sorting libraries. The running time of Quick Sort
depends heavily on choosing the pivot element. Quick sort also belongs to the divide and conquer category of algorithms. It
|
|
|