锘??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美福利专区,国产精品国内视频,久久国产88http://m.shnenglu.com/85940806/category/17032.htmlEnhance Tech and Englishzh-cnFri, 03 Jun 2011 09:26:39 GMTFri, 03 Jun 2011 09:26:39 GMT6010浜夸釜嫻偣鏁?姹傚嚭鍏朵腑鏈澶х殑10000涓?http://m.shnenglu.com/85940806/archive/2011/06/02/147958.htmlMike SongMike SongThu, 02 Jun 2011 08:51:00 GMThttp://m.shnenglu.com/85940806/archive/2011/06/02/147958.htmlhttp://m.shnenglu.com/85940806/comments/147958.htmlhttp://m.shnenglu.com/85940806/archive/2011/06/02/147958.html#Feedback0http://m.shnenglu.com/85940806/comments/commentRss/147958.htmlhttp://m.shnenglu.com/85940806/services/trackbacks/147958.html #include "stdafx.h" #include <vector> #include <iostream> #include <algorithm> #include <functional>// for greater<> usingnamespace std;
int _tmain(int argc, _TCHAR* argv[]) { vector<float> bigs(10000,0); vector<float>::iterator it;
// Init vector data for (it = bigs.begin(); it != bigs.end(); it++) { *it = (float)rand()/7; // random values; }
cout << bigs.size() << endl;
make_heap(bigs.begin(),bigs.end(), greater<float>()); // The first one is the smallest one! float ff; for (int i =0; i <1000000000; i++) { ff = (float) rand() /7; if (ff > bigs.front()) // replace the first one ? { // set the smallest one to the end! pop_heap(bigs.begin(), bigs.end(), greater<float>());
// remove the last/smallest one bigs.pop_back();
// add to the last one bigs.push_back(ff);
// mask heap again, the first one is still the smallest one push_heap(bigs.begin(),bigs.end(),greater<float>()); } }
// sort by ascent sort_heap(bigs.begin(), bigs.end(), greater<float>());
]]>瀛楃涓蹭腑鐨勫崟璇嶉嗗簭鎺掑垪http://m.shnenglu.com/85940806/archive/2011/06/02/147905.htmlMike SongMike SongWed, 01 Jun 2011 16:18:00 GMThttp://m.shnenglu.com/85940806/archive/2011/06/02/147905.htmlhttp://m.shnenglu.com/85940806/comments/147905.htmlhttp://m.shnenglu.com/85940806/archive/2011/06/02/147905.html#Feedback0http://m.shnenglu.com/85940806/comments/commentRss/147905.htmlhttp://m.shnenglu.com/85940806/services/trackbacks/147905.html緇欏畾涓涓瓧絎︿覆, 璇ュ瓧絎︿覆鐢辮嫳鏂囧崟璇嶆瀯鎴? 璇ュ嚱鏁扮殑浣滅敤鏄妸榪欎釜瀛楃涓蹭腑鐨勫崟璇嶉嗗簭鎺掑垪, 姣斿杈撳叆瀛楃涓蹭負(fù)"This is a dog", 閭d箞榪愯璇ュ嚱鏁板悗璇ュ瓧絎︿覆搴旇漿鍖栦負(fù)"dog a is This"
綆楁硶: 閫嗗簭鎵鏈夊瓧絎︿覆,鐒跺悗鍐嶉嗗簭鎵鏈夊崟璇? 涓よ呴『搴忔棤鎵璋?
char* Reverse(char* start, char* end) { if (start == NULL ||*start =='\0'|| end == NULL ||*end =='\0') return NULL;