Insert sorting directly and sort by hill
Why is the code similar !!
/* Name: InsertSortCopyright: Author: huowolf Date: 05/07/15 16: 18 Description: directly Insert the sorting implementation */# include
Using namespace std; int arr [] = {-, 98}; void InsertSort (int a [], int length ); void Output (int a [], int length); int main () {InsertSort (arr, 8); Output (arr, 8); return 0 ;} void InsertSort (int a [], int length) {int I, j; for (I = 2; I <= length; I ++) {if (a [I]
/* Name: ShellSort Copyright: Author: huowolf Date: 05/07/15 16: 18 Description: Implementation of hill sorting */# include
Using namespace std; int arr [] = {-, 98}; void ShellSort (int a [], int length ); void Output (int a [], int length); int main () {ShellSort (arr, 8); Output (arr, 8); return 0 ;} void ShellSort (int a [], int length) {int I, j; int d = length; // initialize the incremental value to do {d = d/3 + 1; // incremental sequence (a classic incremental method without providing the optimum proof) for (I = d + 1; I <= length; I ++) {if (a [I] 0 & a [0] 1); // increment to 1, stop loop} void Output (int a [], int length) {for (int I = 1; I <= length; I ++) cout <