Skip to content

Commit 3d7e20a

Browse files
authored
Merge pull request #928 from iamazhar/master
fixes: typo and punctuation
2 parents 617187b + 5b0861c commit 3d7e20a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Shuffle/README.markdown

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ This code works just fine but it's not very efficient. Removing an element from
3737

3838
## The Fisher-Yates / Knuth shuffle
3939

40-
Here is a much improved version of the shuffle algorithm:
40+
Here is a much-improved version of the shuffle algorithm:
4141

4242
```swift
4343
extension Array {
@@ -52,7 +52,7 @@ extension Array {
5252
}
5353
```
5454

55-
Again, this picks objects at random. In the naive version we placed those objects into a new temporary array so we could keep track of which objects were already shuffled and which still remained to be done. In this improved algorithm, however, we'll move the shuffled objects to the end of the original array.
55+
Again, this picks objects at random. In the naive version, we placed those objects into a new temporary array so we could keep track of which objects were already shuffled and which still remained to be done. In this improved algorithm, however, we'll move the shuffled objects to the end of the original array.
5656

5757
Let's walk through the example. We have the array:
5858

@@ -116,7 +116,7 @@ The `shuffledArray()` function first creates a new array with `n` zeros. Then it
116116

117117
For this function, `The condition that checks if j ≠ i may be omitted in languages that have no problems accessing uninitialized array values, and for which assigning is cheaper than comparing.`, you can check it in wiki. And also remove checking logic will optimise performance.
118118

119-
The algoritm is quite clever and I suggest you walk through an example yourself, either on paper or in the playground. (Hint: Again it splits the array into two regions.)
119+
The algorithm is quite clever and I suggest you walk through an example yourself, either on paper or in the playground. (Hint: Again it splits the array into two regions.)
120120

121121
## See also
122122

0 commit comments

Comments
 (0)