Skip to content

Commit 5d55104

Browse files
authored
Merge pull request #970 from haashem/master
Update `InsertionSort` README.markdown
2 parents 2fdd8b8 + d664df8 commit 5d55104

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Insertion Sort/README.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ insertionSort(list)
114114

115115
Here is how the code works.
116116

117-
1. Make a copy of the array. This is necessary because we cannot modify the contents of the `array` parameter directly. Like Swift's own `sort()`, the `insertionSort()` function will return a sorted *copy* of the original array.
117+
1. Make a copy of the array. This is necessary because we cannot modify the contents of the `array` parameter directly. Like Swift's own `sorted()`, the `insertionSort()` function will return a sorted *copy* of the original array.
118118

119119
2. There are two loops inside this function. The outer loop looks at each of the elements in the array in turn; this is what picks the top-most number from the pile. The variable `x` is the index of where the sorted portion ends and the pile begins (the position of the `|` bar). Remember, at any given moment the beginning of the array -- from index 0 up to `x` -- is always sorted. The rest, from index `x` until the last element, is the unsorted pile.
120120

0 commit comments

Comments
 (0)