Data Structures (Seminar)

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 9

Data Structures

Shiffan Fathima S
19uw30243 ; 19uit108
Iii - B.Sc (IT)
Contents :-
1. About Insertion sort
2. Way of working
3. Example of insertion sort
4. Algorithm
5. Ask questions if any doubt
Insertion sort :-
• Insertion sort is a simple sorting algorithm that works similar to the way
you sort playing cards in your hands.
• Insertion sort is the sorting mechanism where the
sorted array is built having one item at a time.

• The array elements are compared with each other


sequentially and then arranged simultaneously in some
particular order.
Way of working
1. Select. ✅
2. Compare
3. Shift
4. Insert
Example of Insertion sort
Algorithm :-
For(i=1; i<n;i++)
{
temp=a[i];
j=i-1;
While(j>=n && a[j] > temp)
{
a[j+1]=a[j]
j-- ;
}
a[j+1]=temp
}
Ask questions
Thank
You for
Your
attention

You might also like