diff --git a/guide/english/algorithms/sorting-algorithms/insertion-sort/index.md b/guide/english/algorithms/sorting-algorithms/insertion-sort/index.md index bc6317e1b4..aaa50c52bd 100644 --- a/guide/english/algorithms/sorting-algorithms/insertion-sort/index.md +++ b/guide/english/algorithms/sorting-algorithms/insertion-sort/index.md @@ -3,7 +3,7 @@ title: Insertion Sort --- ## Insertion Sort -Insertion sort is the simplest and efficient sorting algorithm for small number of elements. +Insertion sort is a simple sorting algorithm for a small number of elements. ### Example: In Insertion sort, you compare the `key` element with the previous elements. If the previous elements are greater than the `key` element, then you move the previous element to the next position. @@ -83,7 +83,7 @@ Step 5 : ``` ![[ 1 2 3 4 5 8 ]](https://github.com/blulion/freecodecamp-resource/blob/master/insertion_sort/6.png?raw=true) -The below algorithm is slightly optimized version to avoid swapping `key` element in every iteration. Here, the `key` element will be swapped at the end of the iteration (step). +The algorithm shown below is a slightly optimized version to avoid swapping the `key` element in every iteration. Here, the `key` element will be swapped at the end of the iteration (step). ```Algorithm InsertionSort(arr[]) @@ -96,7 +96,7 @@ The below algorithm is slightly optimized version to avoid swapping `key` elemen arr[i+1] = key ``` -Here is a detaied implementation in Javascript: +Here is a detailed implementation in Javascript: ``` function insertion_sort(A) { @@ -115,7 +115,7 @@ function insertion_sort(A) { } ``` -A quick implementation in Swift is as shown below : +A quick implementation in Swift is shown below : ```swift var array = [8, 3, 5, 1, 4, 2]