diff --git a/sorting/insertion_sort.cpp b/sorting/insertion_sort.cpp index 32315a87a..b6a8f72ac 100644 --- a/sorting/insertion_sort.cpp +++ b/sorting/insertion_sort.cpp @@ -23,20 +23,20 @@ * of elements as soon as we find a unsorted element that is a misplaced * element we place it at a sorted position. * - * Execution example steps: + * Example execution steps: * 1. Suppose initially we have - *
4 3 2 5 1
+ * \f{bmatrix}{4 &3 &2 &5 &1\f} * 2. We start traversing from 4 till we reach 1 * when we reach at 3 we find that it is misplaced so we take 3 and place * it at a correct position thus the array will become - *
3 4 2 5 1
+ * \f{bmatrix}{3 &4 &2 &5 &1\f} * 3. In the next iteration we are at 2 we find that this is also misplaced so * we place it at the correct sorted position thus the array in this iteration * becomes - *
2 3 4 5 1
+ * \f{bmatrix}{2 &3 &4 &5 &1\f} * 4. we does not do anything with 5 and move on to the next iteration and * select 1 which is misplaced and place it at correct position. Thus, we have - *
1 2 3 4 5
+ * \f{bmatrix}{1 &2 &3 &4 &5\f} */ #include