摘要: 数据大小是在一个范围内的,可以使用常量大小的辅助空间.不得超过O(n); 1 #include "stdafx.h" 2 #include 3 #include 4 #include 5 using namespace std; 6 7 void SortAges(int ages[],int length) 8 { 9 if(ages==NULL||lengtholdestAge)20 throw new std::exception("age out of range.");21 ++timesOfAge[age];22 }23 ... 阅读全文
posted @ 2014-01-20 10:24 CrazyCode. 阅读(282) 评论(0) 推荐(0)
摘要: 1 #include "stdafx.h" 2 #include 3 #include 4 #include 5 using namespace std; 6 7 8 void swap(int* a ,int *b) 9 {10 int temp = *a;11 *a=*b;12 *b=temp;13 }14 int Partition(int data[],int length,int start,int end)15 {16 if(data==NULL||length=length)17 throw new std::excepti... 阅读全文
posted @ 2014-01-20 09:51 CrazyCode. 阅读(149) 评论(0) 推荐(0)