DOI QR코드

DOI QR Code

3-Points Average Pivot Quicksort

3-점 평균 피벗 퀵정렬

  • Lee, Sang-Un (Dept. of Multimedia Eng., Gangneung-Wonju National University)
  • 이상운 (강릉원주대학교 과학기술대학 멀티미디어공학과)
  • Received : 2014.07.13
  • Accepted : 2014.12.12
  • Published : 2014.12.31

Abstract

In the absence of a sorting algorithm faster than O(n log n), Quicksort remains the best and fastest of its kind in practice. For given n data, Quicksort records running in O(n log n) at best and $O(n^2)$ at its worst. In this paper, I propose an algorithm by which 3-points average P=(L+M+H)/3 is set as a pivot for first array L=a[s], last array H=a[e], and middle array $M=a[{\lfloor}(s+e)/2{\rfloor}]$ in order to find the more fast than Quicksort. Test results prove that the proposed 3-points average pivot Quicksort has the time complexity of O(n log n) at its best, average, and worst cases. And the proposed algorithm can be reduce the $O(n^2)$ time of Quicksort to O(n log n).

데이터를 정렬하는 방법들 중 O(n log n)보다 빠른 방법은 알려져 있지 않고 있으며, 가장 빠른 방법으로 퀵정렬이 있다. n개의 데이터에 대해 퀵정렬은 최적의 경우 O(n log n), 최악의 경우 $O(n^2)$ 수행 복잡도를 갖고 있다. 본 논문에서는 퀵정렬보다 빠르게 정렬하는 방법으로, 분할된 리스트의 첫 번째 L=a[s], 마지막 H=a[e]과 중간 $M=[{\lfloor}(s+e)/2{\rfloor}]$에 대해 P=(L+M+H)/3의 3-점 평균을 피벗값으로 결정하는 방법을 제안하였다. 실험 결과 제안된 3-점 평균 피벗 퀵정렬은 최적, 평균, 최악 모두 수행 복잡도가 O(n log n)으로 퀵정렬의 $O(n^2)$ 정렬 시간을 단축시킬 수 있었다.

Keywords

References

  1. T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein, "Introduction to Algorithms, Chapter 7. Quicksort", 2nd Ed., pp. 145-164, MIT Press, 2005.
  2. D. B. Ring, "A Comparison of Sorting Algorithms", http://www.devx.com/vb2themax/Article/19900, 2003.
  3. S. Nilson, "The Fastest Sorting Algorithm?", http://drdobs.com/architecture-and-design/184404062, Dr. Dobb's Journal, Vol. 311, pp. 38-45, Apr. 2000.
  4. R. Sedgewick, "Algorithms in C, Parts 1-4: Fundamentals, Data Structures, Sorting, Searching", 3rd Ed., Addison-Wesley, 1998.
  5. H. W. Lang, "Sequential and Parallel Sorting Algorithms, Quicksort", FH Flensberg, http://www.inf.fh-flensburg.de/lang/algorithmen/sortieren/quick/quicken.htm, 2011.
  6. C. A. R. Hoare, "Quicksort", The Computer Journal, Vol. 5, No. 1, pp. 10-16, Mar. 1962. https://doi.org/10.1093/comjnl/5.1.10
  7. S. U. Lee, "Quicksort Using Range Pivot," Journal of Korea Society of Computer Information, Vol. 17, No. 4, pp. 139-145, Apr. 2012. https://doi.org/10.9708/jksci.2012.17.4.139
  8. J. W. J. Williams, "Algorithm 232-Heapsort", Communications of the ACM, Vol. 7, No. 6, pp: 347-348, Jun. 1964.
  9. D. Carlson and I. Minerd, "Software Design Using C++: Heap and Heapsort", http://cis. stvincent.edu/html/tutorials/swd/heaps/heaps.html, Computing & Information Science Department, Saint Vincent College, 2011.