Reviw of Sorting Algorihms
Reviw of Sorting Algorihms
www.ijser.in
ISSN (Online): 2347-3878
Volume 2 Issue 3, March 2014
Abstract: One of the fundamental issues in computer science is ordering a list of items. Although there is a huge number of sorting
algorithms, sorting problem has attracted a great deal of research; because efficient sorting is important to optimize the use of other
algorithms. Sorting algorithms have been studied extensively since past three decades. Their uses are found in many applications
including real-time systems, operating systems, and discrete event simulations. In most cases, the efficiency of an application itself
depends on usage of a sorting algorithm. Lately, the usage of graphic cards for general purpose computing has again revisited sorting
algorithms. In this paper we extended our previous work regarding parallel sorting algorithms on GPU, and are presenting an analysis
of parallel and sequential bitonic, odd-even and rank-sort algorithms on different GPU and CPU architectures. Their performance for
various queue sizes is measured with respect to sorting time and rate and also the speed up of bitonic sort over odd-even sorting
algorithms is shown on different GPUs and CPU. The algorithms have been written to exploit task parallelism model as available on
multi-core GPUs using the OpenCL specification.
Keywords: Selection sort, bubble sort, insertion sort, quick sort, merge sort, number of swaps, time complexity
Since the dawn of computing, the sorting problem has void selectionSort(int[] ar){
attracted a great deal of research, perhaps due to the for (int i = 0; i ‹ ar.length-1; i++)
complexity of solving it efficiently despite its simple, {
familiar statement. For example, bubble sort was analyzed as int min = i;
early as 1956. A fundamental limit of comparison sorting for (int j = i+1; j ‹ ar.length; j++)
algorithms is that they require linearithmic time – O(n log n) if (ar[j] ‹ ar[min]) min = j;
– in the worst case, though better performance is possible on int temp = ar[i];
real-world data (such as almost-sorted data), and algorithms ar[i] = ar[min];
not based on comparison, such as counting sort, can have ar[min] = temp;
better performance. Although many consider sorting a }}
solved problem – asymptotically optimal algorithms have Example.
been known since the mid-20th century – useful new 29, 64, 73, 34, 20,
algorithms are still being invented, with the now widely used 20, 64, 73, 34, 29,
Timsort dating to 2002, and the library sort being first 20, 29, 73, 34, 64
published in 2006. 20, 29, 34, 73, 64
20, 29, 34, 64, 73
Sorting algorithms are prevalent in introductory computer The worst-case runtime complexity is O(n2).
science classes, where the abundance of algorithms for the
problem provides a gentle introduction to a variety of core
References
[1] Algorithms in Java, Parts 1-4, 3rd edition by Robert
Sedgewick. Addison Wesley, 2003.
[2] Programming Pearls by Jon Bentley. Addison Wesley,
1986.
[3] Quicksort is Optimal by Robert Sedgewick and Jon
Bentley, Knuthfest, Stanford University, January, 2002.
[4] Dual Pivot Quicksort: Code and Discussion.
[5] Bubble-sort with Hungarian ("Csángó") folk dance
YouTube video, created at Sapientia University, Tirgu
Mures (Marosvásárhely), Romania.
[6] Select-sort with Gypsy folk dance YouTube video,
created at Sapientia University, Tirgu Mures
(Marosvásárhely), Romania.
[7] Sorting Out Sorting, Ronald M. Baecker with the
assistance of David Sherman, 30 minute color sound
film, Dynamic Graphics Project, University of Toronto,
1981. Excerpted and reprinted in SIGGRAPH Video
Review 7, 1983. Distributed by Morgan Kaufmann,
Publishers.
Author Profile
Mr. Gaurav Kocher is perusing Bachelor of
Engineering (CSE) from Shri Shankaracharya Institute
of Professional Management & Technology, Raipur
and presently is in Final Year. His research interests
are Data Structure, Web Designing, Analysis and
design of algorithms.