Skip to content

Commit 8da897d

Browse files
authored
Merge pull request kodecocodes#395 from chizcake/master
Modified typo in README.md of QuickSort
2 parents 2a22a4e + ce1ec88 commit 8da897d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Quicksort/README.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Here's how it works. When given an array, `quicksort()` splits it up into three
3030

3131
All the elements less than the pivot go into a new array called `less`. All the elements equal to the pivot go into the `equal` array. And you guessed it, all elements greater than the pivot go into the third array, `greater`. This is why the generic type `T` must be `Comparable`, so we can compare the elements with `<`, `==`, and `>`.
3232

33-
Once we have these three arrays, `quicksort()` recursively sorts the `less` array and the `right` array, then glues those sorted subarrays back together with the `equal` array to get the final result.
33+
Once we have these three arrays, `quicksort()` recursively sorts the `less` array and the `greater` array, then glues those sorted subarrays back together with the `equal` array to get the final result.
3434

3535
## An example
3636

@@ -44,7 +44,7 @@ First, we pick the pivot element. That is `8` because it's in the middle of the
4444
equal: [ 8, 8 ]
4545
greater: [ 10, 9, 14, 27, 26 ]
4646

47-
This is a good split because `less` and `equal` roughly contain the same number of elements. So we've picked a good pivot that chopped the array right down the middle.
47+
This is a good split because `less` and `greater` roughly contain the same number of elements. So we've picked a good pivot that chopped the array right down the middle.
4848

4949
Note that the `less` and `greater` arrays aren't sorted yet, so we call `quicksort()` again to sort those two subarrays. That does the exact same thing: pick a pivot and split the subarray into three even smaller parts.
5050

0 commit comments

Comments
 (0)