Posts

Showing posts from August, 2019

WHAT IS INSERTION SORT ?

Image
INSERTION SORT  I nsertion sort is a very simple sorting algorithm in which the sorted array (or list) is built one element at a time. We all are familiar with this technique of sorting, as we usually use it for ordering a deck of cards while playing bridge. The main idea behind insertion sort is that it inserts each item into its proper place in the final list. To save memory, most implementations of the insertion sort algorithm work by moving the current data element past the already sorted values and repeatedly interchanging it with the preceding value until it is in its correct place. Insertion sort is less efficient as compared to other more advanced algorithms such as quick sort, heap sort, and merge so Technique    Insertion sort works as follows:  The array of values to be sorted is divided into two sets. One that stores sorted values and another that contains unsorted values.   The sorting algorithm will proceed unti...