Skip to main content

Posts

Featured

Insertion Sort

Insertion Sort

Insertion sort is another simple sorting algorithm which works by dividing the list in two parts, one being sorted and other being un-sorted. We pick elements from the unsorted part of the list and put it at the right place in the sorted part. This sorting algorithm uses the basic principle of progressively sorting the list by looking at each element one by one and placing it at the best possible place.

Insertion Sort will be better understood by the following example.
Let us consider the list  :-   2 4 3 7 9 11 0
( 2 ) 4* 3 7 9 11 0 // 2 is already sorted we start by picking 4. ( 2 4 )  3 7 9 11 0 // we compare 4 with the sorted list, and place it at the appropriate position ( 2 4 )  3* 7 9 11 0 // Pick 3 ( 2 3 4 ) 7 9 11 0  //Put in appropriate place ( 2 3 4 ) 7* 9 11 0 //Pick 7 ( 2 3 4 7 )  9 11 0  //Put 7 at appropriate place ( 2 3 4 7 )  9* 11 0 //Pick 9 ( 2 3 4 7 9 ) 11 0 //Put 9 at appropriate place ( 2 3 4 7 9 ) 11* 0 //Pick 11 ( 2 3 4 7 9 11 ) 0 //Put 11 at ap…

Latest posts

Bubble Sort

Sorting

Elevators Algorithm(LOOK)

Elevators Algorithm (SCAN)

Interval Scheduling

Flow Shop Scheduling Algorithm & CPP Code

Round Robin with weights Algorithm

Analysis of algorithms part 1

Round Robin Algorithm

Applications of Linked List (Queue)