File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 1
1
/// QuickSort is a Divide and Conquer algorithm. It picks an element as
2
- /// a pivot and partitions the given array around the picked pivot.
3
- /// There are many different versions of quickSort that pick pivot in different ways.
2
+ /// a pivot and partitions the given array around the picked pivot.
3
+ /// There are many different versions of quickSort that pick pivot in different ways.
4
4
/// parameters takes an array
5
- /// The key process in quickSort is a partition().
6
- /// The target of partitions is, given an array and an element x of an array as the pivot,
7
- /// put x at its correct position in a sorted array and put all smaller elements (smaller than x) before x,
5
+ /// The key process in quickSort is a partition().
6
+ /// The target of partitions is, given an array and an element x of an array as the pivot,
7
+ /// put x at its correct position in a sorted array and put all smaller elements (smaller than x) before x,
8
8
/// and put all greater elements (greater than x) after x. All this should be done in linear time.
9
9
/// Quicksort's time complexity is O(n*logn) .
10
10
11
-
12
11
pub fn quick_sort < T : Ord > ( array : & mut [ T ] ) {
13
12
match array. len ( ) {
14
13
0 | 1 => return ,
You can’t perform that action at this time.
0 commit comments