Saturday, 16 July 2011

Insertion Sort.

Insertion sorting algorithm is similar to bubble sort. But insertion sort is more  efficient than bubble sort because in insertion sort the elements comparisons are less as compare to bubble sort. In insertion sorting algorithm compare the value until  all the prior elements are lesser than compared value is not found. This mean that the all previous values are lesser than compared value.


Example:
Consider the array list 12,9,4,99,120,1,3,10.


No comments:

Post a Comment