Ijrar research Journal


© 2020 IJRAR September 2020, Volume 7, Issue 3 www.ijrar.org (



Yüklə 0,49 Mb.
Pdf görüntüsü
səhifə6/8
tarix02.06.2023
ölçüsü0,49 Mb.
#115224
1   2   3   4   5   6   7   8
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
 
119 
depends on the operation of the partition. To partition an array of an element called a pivot is selected. The Quick sort algorithm 
works as follows:

Arr [j] = x is the pivot value.

Arr [j…p - 1] contains elements less than x.

Arr [p + 1…r - 1] contains the elements which are larger than or equivalent to x.

Arr[r...k] contains elements which are currently unexplored.
Since the selection of pivot elements is random, therefore average case and best case running time is O(n log n). Moreover, the 
worst case time complexity is O(n*n). Quick sort is not a stable sorting algorithm.
Quick sort algorithm [13] used in the 
experiments below was described by C++ language as shown in fig 5:
Fig. 5 Quick Sort Code 


© 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
 
120 
Fig. 5.1 Example of Quick Sort [14] 
III.
 
C
OMPARISON ON THE BASIS OF COMPLEXITY AND OTHER FACTOR
 
In this paper, there are two classes of Sorting Algorithms:
1.
 
O(n*n):
a.
Bubble Sort
b.
Selection Sort
c.
Insertion Sort
2.
 
O(n log n )
a.
 
Merge Sort
 
b.
 
Quick Sort
 
In best-case conditions (if the list is already in sorted order), the bubble sort can approach a constant O(n) level of complexity, 
while the insertion sort and selection sorts also have complexities; they are significantly more efficient than bubble sort. The 
quick sort is a massively recursive sort. It can be said as merge sort is the faster version of quick sort.
This paper describes five well known sorting algorithms and their running time and stability which is given in the below Table 
1. This table gives the comparison of time complexity or running time of different sorting algorithms and the stability in the 
precise manner


Yüklə 0,49 Mb.

Dostları ilə paylaş:
1   2   3   4   5   6   7   8




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©www.genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə