// 递归和非递归实现直接插入排序.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #includeusing namespace std; //插入排序(非递归) void InsertSort(int *pArr, int nLength) { if (pArr == NULL || nLength <= 0) { return; } int key = 0; int j=0; for (int i=1; i =0&&key = nLength) { return; } int key = pArr[index];//记录当前待插入的元素 int i=0; for (i=index-1; i>=0&&key