Insertion Sort in C

Google Advertisements

Prev Tutorial Next Tutorial

Insertion Sort Program in C

Insertion Sort is a simplest data Sorting algorithm which sorts the array elements by shifting elements one by one and inserting each element into its proper position. This technique is also used for sort array elements. With the help of below animated image you can easily understand and you can also see real life example in second image.

insertion sort insertion sort

Advantage of this sorting technique

It is a simple data Sorting algorithm. It is also better than Selection Sort and Bubble Sort algorithms.

Dis-Advantage of this sorting technique

This sorting technique is slower than quick sort sorting algorithm.

Insertion Sort Program in C


void main() 
int i, j, num, temp, arr[20];
printf("Enter size of array: ");
scanf("%d", &num);

printf("Enter %d elements in arry: \n", num);
for(i=0; i<num; i++)
scanf("%d", &arr[i]);

for(i=1; i<num; i++)

printf("After Sorting elements: ");
for(i=0; i<num; i++)
printf("%d  ", arr[i]);


Enter size of array: 8
Enter 8 elements in arry
After Sorting elements: 1  2  3  4  5  6  7  8
insertion sort program in c

Note: Download above code and de-compress zip file, after that you can easily run this code.

Prev Tutorial Next Tutorial

Google Advertisements

Buy This Ad Space @$50 per Month, Ad Size 600X200 Contact on: or 8076671483

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

Cloud computing is the on demand availability of computer system resources, especially data storage and computing power, without direct active management by the user. Cloud Computing Tutorial

College Projects Related to Java, AWT, C Projects for College, C++ Projects for College, Android Projects. Download Java C C++ Projects

Download Projects

Adsense Advertisements

Buy This ads Space 8076671483

Buy This Ad Space @$120 per Month, Ad Size 300X600 Contact on: or 8076671483 Try this Keyword C++ Programs