SlideShare ist ein Scribd-Unternehmen logo
1 von 89
Insertion Sort CH Gowri Kumar [email_address]
Insertion Sort ,[object Object],[object Object],[object Object],[object Object]
void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
34 8 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
34 8 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
34 8 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
34 8 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
34 8 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for( P = 1 ;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
34 8 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1 ;P<N ; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
34 8 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
34 64 51 32 21 8 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
34 64 51 32 21 8 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for ( j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
34 64 51 32 21 8 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
34 64 51 32 21 8 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
34 64 51 32 21 8 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp;  j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
34 64 51 32 21 8 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1]  > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
34 64 51 32 21 8 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0  && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N;  P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N;  P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1; P<N ; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 32 21 64 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 32 21 64 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for ( j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 32 21 64 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 &&  A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 &&  A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N;  P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N;  P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1; P<N ; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 64 32 21 51 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 64 32 21 51 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for ( j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 64 32 21 51 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 64 32 21 51 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 64 32 21 51 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp;  j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 64 32 21 51 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 64 32 21 51 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 &&  A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 &&  A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N;  P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N;  P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1; P<N ; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for ( j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp;  j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp;  j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp;  j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 &&  A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 &&  A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N;  P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N;  P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1; P<N ; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for ( j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp;  j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp;  j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp;  j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp;  j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 &&  A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 21 32 34 51 64 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 &&  A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 21 32 34 51 64 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N;  P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 21 32 34 51 64 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N;  P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 21 32 34 51 64 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1; P<N ; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
8 21 32 34 51 64 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
The End

Weitere ähnliche Inhalte

Ähnlich wie Insertion Sort Algorithm

Lecture 2
Lecture 2Lecture 2
Lecture 2sajinsc
 
確率的推論と行動選択
確率的推論と行動選択確率的推論と行動選択
確率的推論と行動選択Masahiro Suzuki
 
ゲーム理論BASIC 第22回 -情報不完備ゲームとベイジアンゲーム-
ゲーム理論BASIC 第22回 -情報不完備ゲームとベイジアンゲーム-ゲーム理論BASIC 第22回 -情報不完備ゲームとベイジアンゲーム-
ゲーム理論BASIC 第22回 -情報不完備ゲームとベイジアンゲーム-ssusere0a682
 
chap09alg.ppt for string matching algorithm
chap09alg.ppt for string matching algorithmchap09alg.ppt for string matching algorithm
chap09alg.ppt for string matching algorithmSadiaSharmin40
 
Control as Inference (強化学習とベイズ統計)
Control as Inference (強化学習とベイズ統計)Control as Inference (強化学習とベイズ統計)
Control as Inference (強化学習とベイズ統計)Shohei Taniguchi
 

Ähnlich wie Insertion Sort Algorithm (9)

Lecture 2
Lecture 2Lecture 2
Lecture 2
 
確率的推論と行動選択
確率的推論と行動選択確率的推論と行動選択
確率的推論と行動選択
 
Sorting pnk
Sorting pnkSorting pnk
Sorting pnk
 
ゲーム理論BASIC 第22回 -情報不完備ゲームとベイジアンゲーム-
ゲーム理論BASIC 第22回 -情報不完備ゲームとベイジアンゲーム-ゲーム理論BASIC 第22回 -情報不完備ゲームとベイジアンゲーム-
ゲーム理論BASIC 第22回 -情報不完備ゲームとベイジアンゲーム-
 
Ch5b
Ch5bCh5b
Ch5b
 
Chap09alg
Chap09algChap09alg
Chap09alg
 
chap09alg.ppt for string matching algorithm
chap09alg.ppt for string matching algorithmchap09alg.ppt for string matching algorithm
chap09alg.ppt for string matching algorithm
 
Marksheets of RKDwivedi
Marksheets of RKDwivediMarksheets of RKDwivedi
Marksheets of RKDwivedi
 
Control as Inference (強化学習とベイズ統計)
Control as Inference (強化学習とベイズ統計)Control as Inference (強化学習とベイズ統計)
Control as Inference (強化学習とベイズ統計)
 

Mehr von GowriKumar Chandramouli (9)

Telugu Alphabets
Telugu AlphabetsTelugu Alphabets
Telugu Alphabets
 
Counting Bits
Counting BitsCounting Bits
Counting Bits
 
Azim Premji on Changing World
Azim Premji on Changing WorldAzim Premji on Changing World
Azim Premji on Changing World
 
Who moved my cheese
Who moved my cheeseWho moved my cheese
Who moved my cheese
 
Parable Of a Pencil
Parable Of a PencilParable Of a Pencil
Parable Of a Pencil
 
Radix Sort
Radix SortRadix Sort
Radix Sort
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Linked lists
Linked listsLinked lists
Linked lists
 
Next higher number with same number of binary bits set
Next higher number with same number of binary bits setNext higher number with same number of binary bits set
Next higher number with same number of binary bits set
 

Kürzlich hochgeladen

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 

Kürzlich hochgeladen (20)

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 

Insertion Sort Algorithm

  • 1. Insertion Sort CH Gowri Kumar [email_address]
  • 2.
  • 3. void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 4. 34 8 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 5. 34 8 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 6. 34 8 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 7. 34 8 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 8. 34 8 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for( P = 1 ;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 9. 34 8 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1 ;P<N ; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 10. 34 8 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 11. 34 64 51 32 21 8 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 12. 34 64 51 32 21 8 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for ( j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 13. 34 64 51 32 21 8 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 14. 34 64 51 32 21 8 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 15. 34 64 51 32 21 8 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 16. 34 64 51 32 21 8 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 17. 34 64 51 32 21 8 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 18. 8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 19. 8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 20. 8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 21. 8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1; P<N ; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 22. 8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 23. 8 34 51 32 21 64 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 24. 8 34 51 32 21 64 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for ( j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 25. 8 34 51 32 21 64 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 26. 8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 27. 8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 28. 8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 29. 8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1; P<N ; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 30. 8 34 64 51 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 31. 8 34 64 32 21 51 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 32. 8 34 64 32 21 51 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for ( j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 33. 8 34 64 32 21 51 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 34. 8 34 64 32 21 51 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 35. 8 34 64 32 21 51 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 36. 8 34 64 32 21 51 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 37. 8 34 64 32 21 51 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 38. 8 34 51 64 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 39. 8 34 51 64 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 40. 8 34 51 64 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 41. 8 34 51 64 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 42. 8 34 51 64 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1; P<N ; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 43. 8 34 51 64 32 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 44. 8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 45. 8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for ( j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 46. 8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 47. 8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 48. 8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 49. 8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 50. 8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 51. 8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 52. 8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 53. 8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 54. 8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 55. 8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 56. 8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 57. 8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 58. 8 34 51 64 21 32 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 59. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 60. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 61. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 62. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 63. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1; P<N ; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 64. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 65. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 66. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for ( j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 67. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 68. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 69. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 70. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 71. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 72. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 73. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 74. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 75. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 76. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 77. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 78. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 79. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 80. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 81. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j-- ) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 82. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P; j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 83. 8 32 34 51 64 21 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 84. 8 21 32 34 51 64 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp ; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 85. 8 21 32 34 51 64 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 86. 8 21 32 34 51 64 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++ ) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 87. 8 21 32 34 51 64 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1; P<N ; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }
  • 88. 8 21 32 34 51 64 void InsertionSort(ElementType A[ ], int N) { int j, P; ElementType Tmp; for(P = 1;P<N; P++) { Tmp = A[P]; for (j = P;j>0 && A[j-1] > Tmp; j--) A[ j] = A[j-1]; A[j] = Tmp; } }