Coin163

首页 > Data Structure: Shell Sort

Data Structure: Shell Sort

相关标签: shell 2010 structure

2020腾讯云10周年活动,优惠非常大!(领取2860元代金券),
地址https://cloud.tencent.com/act/cps/redirect?redirect=1040

2020阿里云最低价产品入口,含代金券(新老用户有优惠),
入口地址https://www.aliyun.com/minisite/goods

// ShellSort.cpp : Defines the entry point for the console application. // Create by Xianyi.Ye, July 31st,2010 #include "stdafx.h" #include <iostream.h> void shellSort(int num[], int length) { int d = length/2 ; while(d>=1) { for(int i=d; i<length; i++) { int key = num[i] ; int j=i ; while(key<num[j-d] && (j-d)>=0) { num[j] = num[j-d] ; j = j-d ; } num[j] = key ; }//end for d = d/2 ; }//end while } int main(int argc, char* argv[]) { int num[10] = {49,38,65,97,76,13,27,49,55,4} ; shellSort(num, 10) ; for(int i=0 ; i<10 ; i++) cout<<num[i]<<" " ; cout<<endl ; return 0; }

原文

// ShellSort.cpp : Defines the entry point for the console application. // Create by Xianyi.Ye, July 31st,2010 #include "stdafx.h" #include <iostream.h> void shellSort(int num[], i

------分隔线----------------------------
相关推荐