Wednesday 14 July 2010

Insertion Sort

Insertion Sort:
In a bubble sort, the algorithm divides a list into two sub-lists – one sorted and one unsorted. An imaginary barrier separates the two lists.
The algorithm finds the smallest value in the unsorted list and inserts it in the appropriate place in the sorted list.
In a list with n elements, we need at most n-1 sort passes to order the list.





You may like the following posts:
Data Structures

No comments:

Post a Comment