#include #include using namespace std;
Void insertsort (int A [], int N) {INT I, J, K; For (i = 1; i -1; - j) {IF (k K) / / Ensure in the right side of the end in [0, i-1] is greater than K value (if present) END = MID-1; Else Begin = MID 1;} for (j = i-1; j> end; - j) {a [j 1] = a [j];} a [end 1] = K;}} // Hill algorithm has no best incremental sequence, // When the incremental sequence is DLTA [K] = 2 ^ (T-K 1) -1 is time complexity O (N ^ (3/2)), where t is sorted 1 <= k <= t <= [log2 (n 1)] (floor) // has various tissue, but to pay attention, it should be The value in the incremental sequence does not except for a common factor, and the last increment must be equal to 1 (mutual); // EG: 2 ^ (T-K 1) --- 9 5 3 2 1 VoID Shellsort (int A [], int N) {INT T = (int) (log10 (n 1) / log10 (2)); int K, i, j; for (k = 1; k <= t; K) {INT DK = (int) (POW (2, T-K 1) -1.0); for (i = DK; i -1; J- = DK) {IF (a [j]> comp) a [j DK] = a [j]; else break;} a [j dk] = comp }}}
Int main () {
INT NUM [100]; INT N, I; CIN >> N; for (i = 0; i > NUM [I];} // INSERTSORT (NUM, N); / / Binsertsort (NUM, N); Shellsort (Num, N); for (i = 0; i