shellsort.cpp
来自「Data Abstraction & Problem Solving with 」· C++ 代码 · 共 17 行
CPP
17 行
// See Programming Problem 8void shellsort(DataType theArray[], int n){ for (int h = n/2; h > 0; h = h/2) { for (int unsorted = h; unsorted < n; ++unsorted) { DataType nextItem = theArray[unsorted]; int loc = unsorted; for (; (loc >= h) && (theArray[loc-h] > nextItem); loc = loc - h) theArray[loc] = theArray[loc-h]; theArray[loc] = nextItem; } // end for } // end for} // end shellsort
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?