Hoare partition scheme
E462227
The Hoare partition scheme is a classic in-place array partitioning method used in quicksort that employs two indices moving toward each other to rearrange elements around a pivot.
Statements (47)
| Predicate | Object |
|---|---|
| instanceOf |
algorithm
ⓘ
array partitioning algorithm ⓘ partition scheme ⓘ |
| advantageOverLomuto |
better performance on many inputs
ⓘ
fewer swaps on average ⓘ |
| appearsIn |
algorithms textbooks
ⓘ
data structures and algorithms courses ⓘ |
| category | comparison-based partitioning ⓘ |
| commonPivotChoice |
first element of the array
ⓘ
middle element of the array ⓘ |
| comparedWith | Lomuto partition scheme NERFINISHED ⓘ |
| describedIn | Quicksort paper by C. A. R. Hoare ⓘ |
| doesNotGuarantee | pivot ends at its final sorted position ⓘ |
| ensures | all elements in left part are ≤ some element in right part ⓘ |
| field | computer science ⓘ |
| hasInvariant |
elements left of left index are ≤ pivot candidate region
ⓘ
elements right of right index are ≥ pivot candidate region ⓘ |
| hasProperty |
loop with crossing indices termination condition
ⓘ
two-pointer technique ⓘ |
| implementationDetail |
decrements right index until element ≤ pivot
ⓘ
increments left index until element ≥ pivot ⓘ swaps elements at the two indices when left ≤ right ⓘ |
| influenced | later partitioning algorithms ⓘ |
| introducedBy | C. A. R. Hoare NERFINISHED ⓘ |
| introducedIn | 1961 ⓘ |
| isInPlace | true ⓘ |
| isStable | false ⓘ |
| output | index separating two partitions ⓘ |
| partitionStrategy | two indices moving toward each other ⓘ |
| pivotUsage | rearranges elements around a pivot ⓘ |
| relatedConcept |
divide-and-conquer algorithms
ⓘ
quicksort partition step ⓘ two-way partitioning ⓘ |
| requires | random-access array ⓘ |
| spaceComplexity | O(1) ⓘ |
| subfield |
algorithm design
ⓘ
sorting algorithms ⓘ |
| terminationCondition | indices cross ⓘ |
| timeComplexityAverageCase | O(n) ⓘ |
| typicalImplementationLanguage |
C
NERFINISHED
ⓘ
C++ NERFINISHED ⓘ Java NERFINISHED ⓘ |
| usedFor |
divide-and-conquer sorting
ⓘ
in-place array partitioning ⓘ |
| usedIn |
in-place quicksort implementations
ⓘ
quicksort ⓘ |
| worksWith | total order on elements ⓘ |
Referenced by (1)
Full triples — surface form annotated when it differs from this entity's canonical label.