SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Semelhante a 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
 

Semelhante a 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 (強化学習とベイズ統計)
 

Mais de 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
 

Último

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
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
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
 
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
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
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
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
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
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
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
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
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
 
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
 
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
 

Último (20)

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
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
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
 
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
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
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
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
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
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
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 ...
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
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
 
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
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
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
 

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; } }