Skip to content

Commit 903480d

Browse files
committed
add doc
1 parent 03a31f1 commit 903480d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/strings/quick3.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ where
2828
Self::do_sort(a, 0, n.saturating_sub(1), 0);
2929
}
3030

31+
/// 3-way string quicksort a[lo..hi] starting at d-th character
3132
fn do_sort(a: &mut [T], lo: usize, hi: usize, d: usize) {
3233
if hi <= lo + CUTOFF {
3334
sort::insert::sort_dth(a, lo, hi, d);
@@ -65,11 +66,13 @@ impl<T> Quick3Way<T>
6566
where
6667
T: Ord + Clone,
6768
{
69+
/// Rearranges the array in ascending order, using the natural order.
6870
pub fn sort(a: &mut [T]) {
6971
let n = a.len();
7072
Self::do_sort(a, 0, n.saturating_sub(1));
7173
}
7274

75+
/// quicksort the subarray a[lo .. hi] using 3-way partitioning
7376
fn do_sort(a: &mut [T], lo: usize, hi: usize) {
7477
if hi <= lo {
7578
return;

0 commit comments

Comments
 (0)