We describe two improvements to introspective sorting and selection algorithms: a simple rule for finegrained introspection that detects potential worst-case performance after only a small constant number of partitioning steps, and the use of remedial randomization as an intervention strategy in ord
Introspective Sorting and Selection Algorithms
โ Scribed by DAVID R. MUSSER
- Publisher
- John Wiley and Sons
- Year
- 1997
- Tongue
- English
- Weight
- 93 KB
- Volume
- 27
- Category
- Article
- ISSN
- 0038-0644
No coin nor oath required. For personal study only.
โฆ Synopsis
Quicksort is the preferred in-place sorting algorithm in many contexts, since its average computing time on uniformly distributed inputs is ฮ(N log N), and it is in fact faster than most other sorting algorithms on most inputs. Its drawback is that its worst-case time bound is ฮ(N 2 . Previous attempts to protect against the worst case by improving the way quicksort chooses pivot elements for partitioning have increased the average computing time too much -one might as well use heapsort, which has a ฮ(N log N) worst-case time bound, but is on the average 2-5 times slower than quicksort. A similar dilemma exists with selection algorithms (for finding the i-th largest element) based on partitioning. This paper describes a simple solution to this dilemma: limit the depth of partitioning, and for subproblems that exceed the limit switch to another algorithm with a better worst-case bound. Using heapsort as the 'stopper' yields a sorting algorithm that is just as fast as quicksort in the average case, but also has an ฮ(N log N) worst case time bound. For selection, a hybrid of Hoare's FIND algorithm, which is linear on average but quadratic in the worst case, and the Blum-Floyd-Pratt-Rivest-Tarjan algorithm is as fast as Hoare's algorithm in practice, yet has a linear worst-case time bound. Also discussed are issues of implementing the new algorithms as generic algorithms, and accurately measuring their performance in the framework of the C++ Standard Template Library.
๐ SIMILAR VOLUMES
In the past few years, there has been considerable interest in general purpose computational models of parallel computation to enable independent development of hardware and software. The BSP and related models represent an important step in this direction, providing a simple view of a parallel mach
We consider the problems of selection, routing, and sorting on an n-star graph (with n! nodes), an interconnection network which has been proven to possess many special properties. We identify a tree like subgraph (which we call a "(k, 1, k) chain network") of the star graph which enables us to desi