What is insertion sort?   It is a sorting technique that is based on the partitioning of array into two parts like selection sort, sorted and unsorted.   The process is:-   compare adjacent elements.  if(left > right)  Swap the element  {  check for sorted array whether it is still in sort manner(put j=i and loop in until j is not equal to zero)  - No  check for if(right<left)  swap  do it until at the end of position.  }   Implementation:-    Underline eleemnts are part of sorted array    inside main array loop 14  27  10  33  35  19  42  4  ( 14  10  27  33  35  19  42  4  (here sorted array is distorted hence sorting has been done inside the loop)      inside sorted array loop  10  14  27  33  35  19  42  4   inside main array loop  10  14  27  33  35  19  42  4   inside main array loop 10  14  27  33  35  19  42  4   inside main array loop  10  14  27  33  35  19  42  4       inside sorted array loop 10  14  27  19  33  35  42  4       inside sorted array loop 10  14  19  27...
Data structures, Algorithms and system designs