成功源于积累----波爸

思想决定高度,行动决定成败!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2012年6月24日

摘要: 1、快速排序平均复杂度是nlogn#include<iostream>#include<stdlib.h>#include<time.h>using namespace std;//化分区间,找到最后元素的排序位置。并返回分隔的点(即最后一数据排序的位置)。//划分的区间是[nBegin, nEnd). pData是保存数据的指针int Partition(int *pData, int nBegin, int nEnd){int i = nBegin + rand()%(nEnd - nBegin);int x = pData[i];pData[i] = 阅读全文
posted @ 2012-06-24 23:14 沙场醉客 阅读(247) 评论(0) 推荐(0) 编辑

摘要: #include<iostream>#include<string>#include<map>#include<fstream>using namespace std;int main(){ifstream ifs("test.txt");map<string, int> M;map<string, int>::iterator iter;string t;while(getline(ifs, t)){M[t]++;}string maxStr;int max=0;for(iter = M.begin( 阅读全文
posted @ 2012-06-24 21:22 沙场醉客 阅读(702) 评论(0) 推荐(0) 编辑