﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-Program The Future !</title><link>http://www.cppblog.com/y05zh/</link><description>Program The Future !</description><language>zh-cn</language><lastBuildDate>Mon, 06 Apr 2026 13:14:55 GMT</lastBuildDate><pubDate>Mon, 06 Apr 2026 13:14:55 GMT</pubDate><ttl>60</ttl><item><title>转 STL算法学习 </title><link>http://www.cppblog.com/y05zh/archive/2007/05/22/24644.html</link><dc:creator>y05zh</dc:creator><author>y05zh</author><pubDate>Tue, 22 May 2007 14:16:00 GMT</pubDate><guid>http://www.cppblog.com/y05zh/archive/2007/05/22/24644.html</guid><wfw:comment>http://www.cppblog.com/y05zh/comments/24644.html</wfw:comment><comments>http://www.cppblog.com/y05zh/archive/2007/05/22/24644.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/y05zh/comments/commentRss/24644.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/y05zh/services/trackbacks/24644.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;<a href='http://www.cppblog.com/y05zh/archive/2007/05/22/24644.html'>阅读全文</a><img src ="http://www.cppblog.com/y05zh/aggbug/24644.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/y05zh/" target="_blank">y05zh</a> 2007-05-22 22:16 <a href="http://www.cppblog.com/y05zh/archive/2007/05/22/24644.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>第二类通用算法---修正序列算法</title><link>http://www.cppblog.com/y05zh/archive/2007/05/21/24504.html</link><dc:creator>y05zh</dc:creator><author>y05zh</author><pubDate>Sun, 20 May 2007 16:35:00 GMT</pubDate><guid>http://www.cppblog.com/y05zh/archive/2007/05/21/24504.html</guid><wfw:comment>http://www.cppblog.com/y05zh/comments/24504.html</wfw:comment><comments>http://www.cppblog.com/y05zh/archive/2007/05/21/24504.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/y05zh/comments/commentRss/24504.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/y05zh/services/trackbacks/24504.html</trackback:ping><description><![CDATA[<h2><a name=copy><font style="BACKGROUND-COLOR: #ffffff" color=#0000ff size=3>copy</font></a></h2>
<pre><code>template&lt;class InIt, class OutIt&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OutIt <strong>copy</strong>(InIt first, InIt last, OutIt x);</code></pre>
<code>
<h2><a name=copy_backward>copy_backward</a></h2>
<pre> </pre>
<pre><code>template&lt;class BidIt1, class BidIt2&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BidIt2 <strong>copy_backward</strong>(BidIt1 first, BidIt1 last, BidIt2 x);</code></pre>
<code>
<pre><code>Function:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fill(first,last,val)<br>Description：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 把val的值赋给first,last中所有的元素<br>Parameter：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 起始位置和要赋的值<br></code></pre>
<pre><code>
<pre><code>template&lt;class FwdIt, class Gen&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void<font color=#3366ff> <strong>generate</strong></font>(FwdIt first, FwdIt last, Gen g);</code></pre>
<pre><code></code> </pre>
<pre><code>Function:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=#3333ff> partition</font>(first,last,pred)<br>Description：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在指示器first,last中经过谓词的判断后一分为二<br>Parameter：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 起始位置和谓词</code></pre>
<code></code></code></pre>
<code><code></code></code>
<pre><code><code><code>Function:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=#0000ff>random_shuffle</font>(first,last)<br> Description：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在指示器first,last中随机排列元素<br> Parameter：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 起始位置</code></code></code></pre>
<h2 _fckxhtmljob="2"><a name=copy _fckxhtmljob="2"><font style="BACKGROUND-COLOR: #ffffff" color=#0000ff size=3 _fckxhtmljob="2">copy</font></a></h2>
<meta content=copy name=MS-HKWD _fckxhtmljob="2">
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">template&lt;class InIt, class OutIt&gt;
OutIt <strong _fckxhtmljob="2">copy</strong>(InIt first, InIt last, OutIt x);</code></pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">
<h2 _fckxhtmljob="2"><a style="COLOR: #3417fe" name=copy_backward _fckxhtmljob="2">copy_backward</a></h2>
<meta content=copy_backward name=MS-HKWD _fckxhtmljob="2">
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">template&lt;class BidIt1, class BidIt2&gt;
BidIt2 <strong _fckxhtmljob="2">copy_backward</strong>(BidIt1 first, BidIt1 last, BidIt2 x);</code></pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2"></code>&nbsp;</pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">Function:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fill(first,last,val)<br _fckxhtmljob="2">Description：&nbsp;&nbsp;&nbsp;&nbsp; 把val的值赋给first,last中所有的元素<br _fckxhtmljob="2">Parameter：&nbsp;&nbsp;&nbsp;&nbsp; 起始位置和要赋的值<br _fckxhtmljob="2"></code></pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">template&lt;class FwdIt, class Gen&gt;
void<font color=#3366ff _fckxhtmljob="2"> <strong _fckxhtmljob="2">generate</strong></font>(FwdIt first, FwdIt last, Gen g);</code></pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2"></code>&nbsp;</pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">Function:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=#3333ff _fckxhtmljob="2"> partition</font>(first,last,pred)<br _fckxhtmljob="2">Description：&nbsp;&nbsp;&nbsp;&nbsp; 在指示器first,last中经过谓词的判断后一分为二<br _fckxhtmljob="2">Parameter：&nbsp;&nbsp;&nbsp;&nbsp; 起始位置和谓词</code></pre>
<code _fckxhtmljob="2"></code></code></pre>
<code _fckxhtmljob="2"><code _fckxhtmljob="2"></code></code></code></pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2"><code _fckxhtmljob="2"><code _fckxhtmljob="2">Function:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=#0000ff _fckxhtmljob="2">random_shuffle</font>(first,last)<br _fckxhtmljob="2">&nbsp;Description：&nbsp;&nbsp;&nbsp;&nbsp; 在指示器first,last中随机排列元素<br _fckxhtmljob="2">&nbsp;Parameter：&nbsp;&nbsp;&nbsp;&nbsp; 起始位置</code></code></code></pre>
<code _fckxhtmljob="2"><code _fckxhtmljob="2"><code _fckxhtmljob="2">
<h2 _fckxhtmljob="2"><a style="COLOR: #3417fe" name=remove _fckxhtmljob="2">remove</a></h2>
<meta content=remove name=MS-HKWD _fckxhtmljob="2">
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">template&lt;class FwdIt, class T&gt;
FwdIt <strong _fckxhtmljob="2">remove</strong>(FwdIt first, FwdIt last, const T&amp; val);</code></pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">
<h2 _fckxhtmljob="2"><a name=replace _fckxhtmljob="2">replace</a></h2>
<meta content=replace name=MS-HKWD _fckxhtmljob="2">
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">template&lt;caass FwdIt, class T&gt;
void <strong _fckxhtmljob="2">replace</strong>(FwdIt first, FwdIt last,
const T&amp; vold, const T&amp; vnew);</code></pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2"><strong _fckxhtmljob="2"><font color=#3333ff size=4 _fckxhtmljob="2">reverse</font></strong></code></pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">template&lt;class BidIt&gt;
void <strong _fckxhtmljob="2">reverse</strong>(BidIt first, BidIt last);</code></pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2"></code>&nbsp;</pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2"></code>&nbsp;</pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">Function:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=#3300ff size=4 _fckxhtmljob="2"> rotate</font>(first,middle,last)<br _fckxhtmljob="2">&nbsp;Description：&nbsp;&nbsp;&nbsp;&nbsp; 把从middle到last的元素旋转到first范围处<br _fckxhtmljob="2">&nbsp;Parameter：&nbsp;&nbsp;&nbsp;&nbsp; 起始位置和开始旋转位置<br _fckxhtmljob="2"></code></pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2"></code>&nbsp;</pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">
<h2 _fckxhtmljob="2"><a style="COLOR: #3366ff" name=swap _fckxhtmljob="2">swap</a></h2>
<meta content=swap name=MS-HKWD _fckxhtmljob="2">
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">template&lt;class T&gt;
void <strong _fckxhtmljob="2">swap</strong>(T&amp; x, T&amp; y);</code></pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2"></code>&nbsp;</pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">
<h2 _fckxhtmljob="2"><a name=swap_ranges _fckxhtmljob="2">swap_ranges</a></h2>
<meta content=swap_ranges name=MS-HKWD _fckxhtmljob="2">
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">template&lt;class FwdIt1, class FwdIt2&gt;
FwdIt2 <strong _fckxhtmljob="2">swap_ranges</strong>(FwdIt1 first, FwdIt1 last, FwdIt2 x);</code></pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2"></code>&nbsp;</pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">
<h2 _fckxhtmljob="2"><a name=transform _fckxhtmljob="2">transform</a></h2>
<meta content=transform name=MS-HKWD _fckxhtmljob="2">
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">template&lt;class InIt, class OutIt, class Unop&gt;
OutIt <strong _fckxhtmljob="2">transform</strong>(InIt first, InIt last, OutIt x, Unop uop);//还没弄懂！</code></pre>
</code></pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2"></code>&nbsp;</pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2"></code>&nbsp;</pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">
<h2 _fckxhtmljob="2"><a name=unique _fckxhtmljob="2">unique</a></h2>
<meta content=unique name=MS-HKWD _fckxhtmljob="2">
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">template&lt;class FwdIt&gt;
FwdIt <strong _fckxhtmljob="2">unique</strong>(FwdIt first, FwdIt last);</code></pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2">
</code></pre>
</code></pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2"></code>&nbsp;</pre>
<pre _fckxhtmljob="2"><code _fckxhtmljob="2"></code>&nbsp;</pre>
</code></pre>
</code></pre>
</code></pre>
</code></pre>
<p _fckxhtmljob="2"><code _fckxhtmljob="2"><code _fckxhtmljob="2"><code _fckxhtmljob="2">&nbsp;</p>
<pre _fckxhtmljob="2"><br _fckxhtmljob="2"></code></code></code></code></code></code></code></code><code><code><code><code><code><br>&nbsp;</pre>
<pre>
<h2>
<pre><code></code></pre>
<code>
</code></h2>
</code></code></code></code></code></pre>
<img src ="http://www.cppblog.com/y05zh/aggbug/24504.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/y05zh/" target="_blank">y05zh</a> 2007-05-21 00:35 <a href="http://www.cppblog.com/y05zh/archive/2007/05/21/24504.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>STL通用算法：1、非修正序列算法</title><link>http://www.cppblog.com/y05zh/archive/2007/05/21/24502.html</link><dc:creator>y05zh</dc:creator><author>y05zh</author><pubDate>Sun, 20 May 2007 16:32:00 GMT</pubDate><guid>http://www.cppblog.com/y05zh/archive/2007/05/21/24502.html</guid><wfw:comment>http://www.cppblog.com/y05zh/comments/24502.html</wfw:comment><comments>http://www.cppblog.com/y05zh/archive/2007/05/21/24502.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/y05zh/comments/commentRss/24502.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/y05zh/services/trackbacks/24502.html</trackback:ping><description><![CDATA[<h2><font face=宋体><font size=2>STL通用算法：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Description：<br>1、非修正序列算法&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 不对其所作用的容器进行修改<br>2、修正序列算法&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 对其所作用的容器进行修改<br>3、排序算法&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 对容器的内容进行不同方式的排序<br>4、数值算法&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 对容器的内容进行数值计算</font><br><font size=1>Function:&nbsp;&nbsp;&nbsp; adjacent_find(first,last) <br>Description： 搜索重复对<br>Parameter：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 搜索时的起始位置<br>Return：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 返回在该区间第一个重复的对. </font></font><br>count（first,last，val);</h2>
<h2><code><a name=equal>equal</a></code></h2>
<pre>
<pre><code>template&lt;class InIt1, class InIt2&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bool <strong><font color=#ff0000>equal</font></strong>(InIt1 first, InIt1 last, InIt2 x);
template&lt;class InIt1, class InIt2, class Pred&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bool <strong><font color=#ff0000>equal</font></strong>(InIt1 first, InIt1 last, InIt2 x, Pred pr);</code></pre>
<pre><code></code> </pre>
<pre><code><font size=2><font size=3><font color=#0000ff>for_each</font>(</font>first,last,func)</font><br>&nbsp;&nbsp;&nbsp;&nbsp; 对first,last范围内每个元素执行func定义的函数<br> first,last要执行元素的范围，func自己定义的函数</code></pre>
<code></code></pre>
<pre><code><code>
<pre>第一类--非修正序列算法还有其他函数<br></pre>
</code>
<p>equal(first,last,first2)<br>
find(first,last,val)<br>
find_end(first,last,first2,last2)<br>
find_first(first,last,first2,last2)<br>
mismatch(first,last,first2)<br>
search(first,last,first2,last2)</p>
<p> </p>
</code></pre>
<img src ="http://www.cppblog.com/y05zh/aggbug/24502.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/y05zh/" target="_blank">y05zh</a> 2007-05-21 00:32 <a href="http://www.cppblog.com/y05zh/archive/2007/05/21/24502.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>STl学习</title><link>http://www.cppblog.com/y05zh/archive/2007/05/21/24500.html</link><dc:creator>y05zh</dc:creator><author>y05zh</author><pubDate>Sun, 20 May 2007 16:31:00 GMT</pubDate><guid>http://www.cppblog.com/y05zh/archive/2007/05/21/24500.html</guid><wfw:comment>http://www.cppblog.com/y05zh/comments/24500.html</wfw:comment><comments>http://www.cppblog.com/y05zh/archive/2007/05/21/24500.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/y05zh/comments/commentRss/24500.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/y05zh/services/trackbacks/24500.html</trackback:ping><description><![CDATA[<p>谓词是stl用来确定容器中元素信息的一种函数。用户可以自己定义！</p>
<p>stl是一个容器类模板库和算法库！</p>
<p>序列容器（sequence container ）:向量（vector）链表（list),双端队列（deque）； </p>
<p>容器适配器：堆栈（stack),队列(queue),优先队列（priorty_queue);</p>
<p>关联容器（assocjative container ）:集合（set),多重集合（multiset),映射（map),</p>
<p>多重映射（multimap)；</p>
<p>迭代器（iterator);</p>
<img src ="http://www.cppblog.com/y05zh/aggbug/24500.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/y05zh/" target="_blank">y05zh</a> 2007-05-21 00:31 <a href="http://www.cppblog.com/y05zh/archive/2007/05/21/24500.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>并查集</title><link>http://www.cppblog.com/y05zh/archive/2007/05/21/24498.html</link><dc:creator>y05zh</dc:creator><author>y05zh</author><pubDate>Sun, 20 May 2007 16:21:00 GMT</pubDate><guid>http://www.cppblog.com/y05zh/archive/2007/05/21/24498.html</guid><wfw:comment>http://www.cppblog.com/y05zh/comments/24498.html</wfw:comment><comments>http://www.cppblog.com/y05zh/archive/2007/05/21/24498.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/y05zh/comments/commentRss/24498.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/y05zh/services/trackbacks/24498.html</trackback:ping><description><![CDATA[<p>主要有三个函数：</p>
<p>void UFset()//初始化<br>{<br>for(int i=0;i&lt;N;i++)<br>{<br>&nbsp;&nbsp; parent[i]=-1;<br>}<br>}</p>
<p><br>int find(int x)//返回X节点所属集合的根节点<br>{<br>for(int i=x;parent[i]&gt;=0;i=parent[i]);<br>while(i!=x)//优化方案--压缩路径<br>{<br>&nbsp;&nbsp; int tmp=parent[x];<br>&nbsp;&nbsp; parent[x]=i;<br>&nbsp;&nbsp; x=tmp;<br>}<br>return i;<br>}</p>
<p><br>void Union(int R1,int R2)//将两个不同集合的元/////////素进行合并，使两个集合中任两个元素都连通</p>
<p>{<br>int tmp=parent[R1]+parent[R2];<br>if(parent[R1]&gt;parent[R2])//优化方案――加权法则</p>
<p>{<br>&nbsp;&nbsp; parent[R1]=R2;<br>&nbsp;&nbsp; parent[R2]=tmp;<br>}<br>else<br>{<br>&nbsp;&nbsp; parent[R2]=R1;<br>&nbsp;&nbsp; parent[R1]=tmp;<br>}<br>}</p>
<img src ="http://www.cppblog.com/y05zh/aggbug/24498.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/y05zh/" target="_blank">y05zh</a> 2007-05-21 00:21 <a href="http://www.cppblog.com/y05zh/archive/2007/05/21/24498.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>