This action might not be possible to undo. Are you sure you want to continue?

4, July 2010

Chunk Sort

**Syed Zaki Hassan Kazmi
**

Department of Computer Science IQRA University Islamabad Campus Pakistan zaki.mzd@gmail.com

**Syeda Shehla Kazmi
**

Department of Computing & Mathematics Manchester Metropolitan University, United Kingdom shehla_kazmi@hotmail.com

**Syeda Sobia Hassan Kazmi
**

Department of Computer Science The University Of Azad Jammu And Kashmir Muzaffarabad A.K, Pakistan fajar_zara@hotmail.com

**Syed Raza Hussain Bukhari
**

Department of Computer Science The University Of Azad Jammu And Kashmir Muzaffarabad A.K, Pakistan razabukhari@hotmail.com consume a substantial time in ordering the data. The computational problems always have a cumbersome effect on the researchers on one hand and open the opportunities for them on the other hand. The study in hand proposes a new sorting technique that is tested and analyzed against merge sort and quick sort to provide its efficiency. This paper is organized as follows; Section II presents a brief review of existing sorting algorithms. Section III presents the description of proposed solution. Section IV presents the proposed algorithm. Section V presents Running Cost Analysis. Section VI present comparison between chunk sort with merge sort and quick sort. Section VII ends with concluding remarks. II. A BRIEF REVIEW OF EXISTING SORTING ALGORITHMS

Abstract—the objective of this paper is to develop new efficient sorting technique known as Chunk Sort. Chunk sort is based on the idea of Merge Sort. In this sort divide main data list into number of sub list then sort sub list and combine them until the whole list become sorted. The difference between merge sort and chunk sort is, merge sort merge two sub list in to one, but chunk sort merge three sub list in to single sorted list. It is fast then many existing sorting techniques including merge sort and quick sort. Running Cost analysis and the result obtained after implementation are provided in the graphical form with an objective to compare the efficiency of the technique with quick sort and merge sort, as both are consider as efficient and fast one. Keywords-Sorting;Merge Sort; Quick Sort.

I.

INTRODUCTION

Algorithms have a vital and key role in solving the computational problems, informally an algorithm is a well defined computational procedure that takes input and produces output. Algorithm is a tool or a sequence of steps to solve the computational problems [1]. An Algorithm is a step by step process to solve a particular problem in a finite amount of time and has a fundamental and key role in solving the computational problems. Informally an algorithm is a well-defined computational procedure that takes input and produces output. So a Sorting Algorithm is the step by step process by which data is organized into a particular increasing or decreasing order, i.e. in ascending and descending order. Data can be in numerical or character form in particular and can be in other forms as well. There are a lot of sorting techniques, currently used in industry and academia, to arrange the data of various forms and from different areas. Sorting is of substantial importance as the human is obsessed in keeping the ordered information/knowledge. To search the particular data efficiently the arrangement of data is very important. To facilitate the human, computers

A number of sorting techniques are currently used in the field of computer science. This section will briefly discuss some of the trendy sorting techniques among them. These are following: A. Merge Sort Merge sort is an O (n log n) sorting algorithm. It belongs to the family “Sorting by Merging”. It is an example of the divide and conquer algorithmic paradigm. It was proposed by John von Neumann in 1945 (Cormen T. H, Leiserson C. E., Rivest R. L. and Stein C. [1990] 2001). Conceptually, a merge sort works as follows: 1. If the list is of length 0 or 1, then it is already sorted. Otherwise: 2. Divide the unsorted list into two sublists of about half the size. 3. Sort each sublist recursively by re-applying merge sort. 4. Merge the two sublists back into one sorted list.

162

http://sites.google.com/site/ijcsis/ ISSN 1947-5500

(IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 4, July 2010

B.

Quick Sort Quick sort is another well-known sorting algorithm and base on divide-and-conquer paradigm. Its worst-case running time is Θ(n²) having a list of n items. In spite of slow worst-case running time, quick sort is often the best practical choice for sorting the lists because it is extremely efficient on the average running time i.e. Θ(nlogn). In most real-world data it is possible to make design choices which minimize the probability of requiring quadratic time (Cormen T. H, Leiserson C. E., Rivest R. L. and Stein C. Quicksort 2001). III. CHUNK SORT Chunk sort is based on the idea of Merge Sort. In this sort divide main data list into number of sub list then sort sub list and combine them until the whole list become sorted. The difference between merge sort and chunk sort is, merge sort merge two sub list in to one, but in chunk sort merge three sub list in to single sorted list. It is fast then many existing sorting techniques including merge sort and quick sort. Conceptually, a Chunk sort works as follows: 1. If the list is of length 0 or 1, then it is already sorted. Otherwise: 2. Divide the unsorted list into three sublists. 3. Sort each sublist. 4. Merge the three sublists back into one sorted list.

sqrr = 1 p2 = 0 while sqrr != l { p1 = 0 p3 = 0 while p3 < l { r=2 p3 = p3 + sqr if p3 > l { p3 = l } while p2 != p3 - 1 { p4 = p2 + 1 p2 = p2 + sqrr if p2 >= p3 { p2 = p3 - 1 } if r % 2 == 0 { if arr[p1] >= arr[p2] { r=r+1 j = p1 for k = p4; k <= p2; k++ { temp[j] = arr[k] j++ } x = p1 while x != p4 { temp[j] = arr[x] x++ j++ } } else { If arr[p4]<arr[p4-1] { r=r+1 j=p1 x=p4 for k = p1; k <= p2; k++ { if arr[j] <= arr[x] { temp[k] = arr[j] j++ if j == p4 { k++ while k <= p2 { temp[k] = arr[x] x++ k++

IV.

ALGORITHM : PSEUDO CODE

Square Root Sort (arr) temp = temperary Array l = length[arr] length = l t=l/4 sqr = 3

163

http://sites.google.com/site/ijcsis/ ISSN 1947-5500

(IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 4, July 2010

} }} else { temp[k] = arr[x] x++ if(x>p2) { k++ while k<=p2 { temp[k] = arr[j] j++ k++ } }}}}}} else { if temp[p1] >= arr[p2] { r = r + 1; j = p1 for k = p4; k <= p2; k++ { arr[j] = arr[k] j++ } x = p1 while x != p4 { arr[j] = temp[x] x++ j++ } } else { if arr[p4] < temp[p4 - 1] { r=r+1 j = p1 x = p4 for k = p1; k <= p2; k++ { if temp[j] <= arr[x] { arr[k] = temp[j] j++ if j == p4 { k++ while k <= p2 { arr[k] = arr[x] x++ k++ } } } else } } }

{ arr[k] = arr[x] x++ if x > p2 { k++ while k <= p2 { arr[k] = temp[j] j++ k++ } } }

else { r=r+1 for k = p1; k <p4; k++ { arr[k] = temp[k] } } }

} if r % 2 != 0 && p1 != p2 { for j = p1; j <= p2; j++ { arr[j] = temp[j] } } p1 = p2 + 1 p2 = p1 + sqrr - 1 } sqrr = sqr p2 = sqrr - 1 if sqr >= t { sqr = l } else { sqr = sqr * 3 } }

164

http://sites.google.com/site/ijcsis/ ISSN 1947-5500

(IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 4, July 2010

V.

RUNNING COST ANALYSIS

In order to get a better handle of what the resulting complexity might be, suppose that we denoted by T(n) the amount of time that Chunk Sort uses on an array of size n. Recall that executing a sequence of instructions will cause us to add the running time. Hence, the running time will obey the following equation: T(n) = T(n/3)+ T(n/3)+ T(n/3)+Tmerge(n) = 3T(n/3)+cn where c is a constant, reflecting the actual number of basic operations (comparisons, tests, arithmetic operations, assignments) in the merge routine. we would like to get a closed formula for T, or at least figure out what its fastestgrowing term is (so that we can figure out O() for the algorithm).To get a better grip on the problem, let us unwind T for a couple more steps: T(n) = 3T(n/3)+cn T(n) = 3(3T(n/9)+cn/3)+cn=32 T(n/9)+2cn T(n) = 32 (3T(n/27)+cn/9)+cn=32 T(n/27)+3cn How many times can we continue this expansion? Until we get to T(1) which is 1(this corresponds to the base case of running on an array of size 1). Since in each step we divide n, we will reach T(1) is log3 n steps. At that point, we will have: T(n) = 2log3 nT(1)+cn log3 n The first term above is O(n), the second is O(n log3 n), so the whole algorithm is T (n) = O(n log3 n) VI. COMPARISON OF CHUNK SORT WITH MERGE SORT AND QUICK SORT

It can be observed from the Table 1 and graph presented in Figure 1 that performance of proposed algorithm (Chunk Sort) is far better than the Quick Sort and Merge Sort. Table 2 shows the comparison of the proposed algorithm (Chunk Sort) with the traditional sorting algorithms on the basis of execution time when input data list is in ascending order. Graphical view of the same analysis is presented in the Figure 2

Table 2: Chunk Sort v/s Merge Sort and Quick Sort

45000 40000 35000 30000 25000 20000 15000 10000 5000 0

Execution Time(ms)

Square Root Sort Merge Sort Quick Sort

Table 1 show the comparison of the proposed algorithm (Chunk Sort) with the traditional sorting algorithms on the basis of execution time when input data list is in descending order. Graphical view of the same analysis is presented in the Figure 1.

It can be observed from the Table 2 and graph presented in Figure 2 that performance of proposed algorithm (Chunk Sort) is far better than the Quick Sort and Merge Sort.

Table 1: Chunk Sort v/s Merge Sort and Quick Sort

**50000 40000 30000 20000 10000 0
**

50 00 00 10 00 0 20 00 00 0 40 00 00 0

Execution Time(ms)

Square Root Sort Merge Sort Quick Sort

Table 3 shows the comparison of the proposed algorithm (Chunk Sort) with the traditional sorting algorithms on the basis of execution time when input data list is generated by random numbers. Graphical view of the same analysis is presented in the Figure 3.

No. of Elements

Figure 1: Chunk Sort v/s Merge Sort and Quick Sort

165

10 00 0 50 00 00 20 00 00 0 40 00 00 0

No. of Elements

Figure 2: Chunk Sort v/s Merge Sort and Quick Sort

Table 3: Chunk Sort v/s Merge Sort and Quick Sort

http://sites.google.com/site/ijcsis/ ISSN 1947-5500

**80000 70000 60000 50000 40000 30000 20000 10000 0
**

10 00 0 50 00 00 20 00 00 0 40 00 00 0

Square Root Sort Merge Sort Quick Sort

[8] Cormen T. H, Leiserson C. E., Rivest R. L. and Stein C. [1990] (2001). “Introduction to Algorithms”, 2nd edition, MIT Press and McGrawHill, ISBN 0-262-03293-7, pp. 27–37. Section 2.3: Designing algorithms. [9] Cormen T. H, Leiserson C. E., Rivest R. L. and Stein C. (2001). “Introduction to Algorithms”, 2nd edition, MIT Press and McGrawHill, ISBN 0-262-03293-7, pp. 145-149. Section 7.1: Quick Sort. [10] Cook C. R., Kim D. J. (1980) “Best Sorting Algorithms for Nearly Sorted Lists”, Communication of ACM, Vol. 11, Issue 11, pp 620-624. [11]Wainwright R.L. (1985) “A Class of Sorting Algorithms based on Quick Sort”, Communication of ACM, Vol. 28, Issue 4, pp 396-402.

Execution Time(ms)

No. of Elements

Figure 3: Chunk Sort v/s Merge Sort and Quick Sort

It can be observed from the Table 6.8 and graph presented in Figure 6.11 that performance of proposed algorithm (Chunk Sort) is far better than the Quick Sort and Merge Sort. VII. CONCLUSION By analyzing the graphs above, it can be easily examined that Chunk Sort is efficient then merge sort and quick sort. In future, we are foreseeing to come up with a new sorting technique, which hopefully will be more efficient. ACKNOWLEDGMENT We acknowledge the support and contribution from our loving and caring families, teachers and friends in continuing the education and research. With their moral and financial support, we are in higher education, which encourages us to write this research for the ease of human kind. Thank you all. REFERENCES

[1] Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduction to Algorithms, Second Edition. MIT Press and McGraw-Hill, 2001. ISBN 0-262-03293-7. Section 1.1: Algorithms, pp.5–6. [2] Knuth D. (1997) “The Art of Computer Programming, Volume 3: Sorting and Searching’’, Third Edition. Addison-Wesley, 1997. ISBN 0-201-89685-0. [3] Philippas T., Yi Z. (2003), “A Simple, Fast Parallel Implementation of Quicksort and its Performance, Evaluation on SUN Enterprise 10000”. IEEE- Euro micro Conference on Parallel, Distributed and Network-Based Processing (Euro-PDP’03). ISBN: 0-7695-1875-3/03 [4] Iqbal Z., Gull H. and Muzaffar A. W. (2009) “A New Friends Sort Algorithm”. 2nd IEEE International Conference on Software Engineering and Information Technology, ISBN 978-1-4244-4520-2, pp 326-329. [5] Merritt S. M. (1985), “An inverted taxonomy of Sorting Algorithms”. ACM Journal, Programming Techniques and Data Structures, Vol. 28, Number 1. [6] Green, C., Barstow. D. (1978), “On program synthesis knowledge”. Artif. Infd. 10, pp. 241-279. [7] Hildebrandt P. and Isbitz H. (1959) “Radix Exchange—An Internal Sorting Method for Digital Computers”. Journal of the ACM Volume 6, Issue 2, ISSN: 0004-5411 pp: 156 – 163.

166

http://sites.google.com/site/ijcsis/ ISSN 1947-5500

- Journal of Computer Science IJCSIS March 2016 Part II
- Journal of Computer Science IJCSIS March 2016 Part I
- Journal of Computer Science IJCSIS April 2016 Part II
- Journal of Computer Science IJCSIS April 2016 Part I
- Journal of Computer Science IJCSIS February 2016
- Journal of Computer Science IJCSIS Special Issue February 2016
- Journal of Computer Science IJCSIS January 2016
- Journal of Computer Science IJCSIS December 2015
- Journal of Computer Science IJCSIS November 2015
- Journal of Computer Science IJCSIS October 2015
- Journal of Computer Science IJCSIS June 2015
- Journal of Computer Science IJCSIS July 2015
- International Journal of Computer Science IJCSIS September 2015
- Journal of Computer Science IJCSIS August 2015
- Journal of Computer Science IJCSIS April 2015
- Journal of Computer Science IJCSIS March 2015
- Fraudulent Electronic Transaction Detection Using Dynamic KDA Model
- Embedded Mobile Agent (EMA) for Distributed Information Retrieval
- A Survey
- Security Architecture with NAC using Crescent University as Case study
- An Analysis of Various Algorithms For Text Spam Classification and Clustering Using RapidMiner and Weka
- Unweighted Class Specific Soft Voting based ensemble of Extreme Learning Machine and its variant
- An Efficient Model to Automatically Find Index in Databases
- Base Station Radiation’s Optimization using Two Phase Shifting Dipoles
- Low Footprint Hybrid Finite Field Multiplier for Embedded Cryptography

the objective of this paper is to develop new efficient sorting technique known as Chunk Sort. Chunk sort is based on the idea of Merge Sort. In this sort divide main data list into number of sub l...

the objective of this paper is to develop new efficient sorting technique known as Chunk Sort. Chunk sort is based on the idea of Merge Sort. In this sort divide main data list into number of sub list then sort sub list and combine them until the whole list become sorted. The difference between merge sort and chunk sort is, merge sort merge two sub list in to one, but chunk sort merge three sub list in to single sorted list. It is fast then many existing sorting techniques including merge sort and quick sort. Running Cost analysis and the result obtained after implementation are provided in the graphical form with an objective to compare the efficiency of the technique with quick sort and merge sort, as both are consider as efficient and fast one.

- ITK279 Paper1
- ShellSort
- DuaL Heap Sort.pdf
- Selection Sort with Improved Asymptotic Time Bounds
- Comb Sorting
- Sorting
- 1
- Divide and Conquer-3
- asysmptotic behavious
- Optimized Select Algo
- searching and sorting algorithm
- Sorting Algorithms
- 2 Sorting
- Comparación de los Algoritmos de Busqueda.
- 05AdvTopicsSorting.pdf
- Lec-8-12-Algo-Spr15-MergeSort-QuickSort-.ppt
- Sorting Insertion Sort Merge Sort
- Sorting Algorithms
- Design and Analysis of Algorithms
- Introduction
- Sorting
- Lecture-39 Internal Sorting Techniques
- data analysis &algorithm
- C-Sorting
- Algo
- ADA 3-5
- CS302FinalGuide_2
- Algorithms Solutions Ch 01
- Shell Sort
- Bidirectional Bubble Sort Approach to Improving the Performance of Introsort in the Worst Case for Large Input Size

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue reading from where you left off, or restart the preview.

scribd