Embed presentation
Download to read offline



























































![Insertion sort algorithm:
for(i=1,i<n,i++)
{
temp=a[i]
j=i-1;
While(j>=0 &&a[j]>temp)
{
a[j+1]=a[j];
j--;
}
a[j+1]=temp;
}](https://image.slidesharecdn.com/1-240129084954-f4b2d16f/85/1-Insertion-Sort-sorting-algorith-pptx-60-320.jpg)
The document provides an analysis of the insertion sort algorithm, which sorts an array by repeatedly picking the next element and inserting it into the correct position within the sorted portion of the array. The algorithm iterates through each element, comparing and shifting elements as necessary until the whole array is sorted. Its efficiency and step-by-step mechanics are highlighted in the provided code implementation.



























































![Insertion sort algorithm:
for(i=1,i<n,i++)
{
temp=a[i]
j=i-1;
While(j>=0 &&a[j]>temp)
{
a[j+1]=a[j];
j--;
}
a[j+1]=temp;
}](https://image.slidesharecdn.com/1-240129084954-f4b2d16f/85/1-Insertion-Sort-sorting-algorith-pptx-60-320.jpg)