This document discusses insertion sort and provides C code to implement insertion sort. The code takes in an array of integers as input, sorts the array using insertion sort, and prints out the sorted array after each iteration. It loops through the array, selects an element, finds its correct position in the sorted part of the array, and inserts it there by shifting other elements over.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
88 views
Algorithm Design and Analysis
This document discusses insertion sort and provides C code to implement insertion sort. The code takes in an array of integers as input, sorts the array using insertion sort, and prints out the sorted array after each iteration. It loops through the array, selects an element, finds its correct position in the sorted part of the array, and inserts it there by shifting other elements over.