﻿<?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++博客-坚持到底就是胜利</title><link>http://www.cppblog.com/ailab/</link><description>用心去做好这件事情</description><language>zh-cn</language><lastBuildDate>Sun, 12 Apr 2026 16:41:08 GMT</lastBuildDate><pubDate>Sun, 12 Apr 2026 16:41:08 GMT</pubDate><ttl>60</ttl><item><title>other algorithm</title><link>http://www.cppblog.com/ailab/archive/2006/11/21/15523.html</link><dc:creator>ailab</dc:creator><author>ailab</author><pubDate>Tue, 21 Nov 2006 14:11:00 GMT</pubDate><guid>http://www.cppblog.com/ailab/archive/2006/11/21/15523.html</guid><wfw:comment>http://www.cppblog.com/ailab/comments/15523.html</wfw:comment><comments>http://www.cppblog.com/ailab/archive/2006/11/21/15523.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ailab/comments/commentRss/15523.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ailab/services/trackbacks/15523.html</trackback:ping><description><![CDATA[111<img src ="http://www.cppblog.com/ailab/aggbug/15523.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ailab/" target="_blank">ailab</a> 2006-11-21 22:11 <a href="http://www.cppblog.com/ailab/archive/2006/11/21/15523.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>tree algorithm</title><link>http://www.cppblog.com/ailab/archive/2006/11/21/15522.html</link><dc:creator>ailab</dc:creator><author>ailab</author><pubDate>Tue, 21 Nov 2006 14:11:00 GMT</pubDate><guid>http://www.cppblog.com/ailab/archive/2006/11/21/15522.html</guid><wfw:comment>http://www.cppblog.com/ailab/comments/15522.html</wfw:comment><comments>http://www.cppblog.com/ailab/archive/2006/11/21/15522.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ailab/comments/commentRss/15522.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ailab/services/trackbacks/15522.html</trackback:ping><description><![CDATA[
		<ol>
				<li> travel tree without stack or recursive</li>
				<li>three travel using none recursive</li>
				<li>delete a element in binary search tree</li>
				<li>count words(using bst)</li>
				<li>level-travel(using queue)<br /></li>
		</ol>
<img src ="http://www.cppblog.com/ailab/aggbug/15522.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ailab/" target="_blank">ailab</a> 2006-11-21 22:11 <a href="http://www.cppblog.com/ailab/archive/2006/11/21/15522.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>array algorithm</title><link>http://www.cppblog.com/ailab/archive/2006/11/21/15521.html</link><dc:creator>ailab</dc:creator><author>ailab</author><pubDate>Tue, 21 Nov 2006 14:11:00 GMT</pubDate><guid>http://www.cppblog.com/ailab/archive/2006/11/21/15521.html</guid><wfw:comment>http://www.cppblog.com/ailab/comments/15521.html</wfw:comment><comments>http://www.cppblog.com/ailab/archive/2006/11/21/15521.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ailab/comments/commentRss/15521.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ailab/services/trackbacks/15521.html</trackback:ping><description><![CDATA[
		<ol>
				<li>insert a value into sorted array</li>
				<li>select nth element</li>
				<li>delete duplicate element</li>
				<li>find there exits two same items in a array</li>
				<li>find duplicate element a[0.N-1]. range from 1--N-1</li>
				<li>a+b = s</li>
				<li>find prim</li>
				<li>occurs odd </li>
				<li>findMidArray</li>
		</ol>
<img src ="http://www.cppblog.com/ailab/aggbug/15521.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ailab/" target="_blank">ailab</a> 2006-11-21 22:11 <a href="http://www.cppblog.com/ailab/archive/2006/11/21/15521.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>list algorithm</title><link>http://www.cppblog.com/ailab/archive/2006/11/21/15520.html</link><dc:creator>ailab</dc:creator><author>ailab</author><pubDate>Tue, 21 Nov 2006 14:09:00 GMT</pubDate><guid>http://www.cppblog.com/ailab/archive/2006/11/21/15520.html</guid><wfw:comment>http://www.cppblog.com/ailab/comments/15520.html</wfw:comment><comments>http://www.cppblog.com/ailab/archive/2006/11/21/15520.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ailab/comments/commentRss/15520.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ailab/services/trackbacks/15520.html</trackback:ping><description><![CDATA[
		<ol>
				<li>reverse_list (none-recursive &amp;&amp; recursive)
</li>
				<li>merge list
</li>
				<li>find middle element of a list
</li>
				<li>find the nth element from the end of list
</li>
				<li>insert a element to a sorted single linked list
</li>
				<li>sort single linked list
</li>
				<li>swap every two element in a single linked list
</li>
				<li>circle &amp;&amp; the start point 
</li>
				<li>meet together
</li>
				<li>ploy multi</li>
		</ol>
		<p> </p>
<img src ="http://www.cppblog.com/ailab/aggbug/15520.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ailab/" target="_blank">ailab</a> 2006-11-21 22:09 <a href="http://www.cppblog.com/ailab/archive/2006/11/21/15520.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>string algorithm</title><link>http://www.cppblog.com/ailab/archive/2006/11/21/15517.html</link><dc:creator>ailab</dc:creator><author>ailab</author><pubDate>Tue, 21 Nov 2006 13:58:00 GMT</pubDate><guid>http://www.cppblog.com/ailab/archive/2006/11/21/15517.html</guid><wfw:comment>http://www.cppblog.com/ailab/comments/15517.html</wfw:comment><comments>http://www.cppblog.com/ailab/archive/2006/11/21/15517.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ailab/comments/commentRss/15517.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ailab/services/trackbacks/15517.html</trackback:ping><description><![CDATA[
		<ol>
				<li>word_count</li>
				<li>reverse_string</li>
				<li>reverse_word in a sentence</li>
				<li>longest increasing subsequence</li>
				<li>longest common subsequence</li>
				<li>strstr</li>
				<li>trim {space}</li>
				<li>compress letter</li>
				<li>atoi</li>
				<li>atof</li>
				<li>find all increasing subsequence</li>
				<li>
						<span class="ArticleSection_ListBriefDescription">Find out if a string is a palindrome.</span>
				</li>
				<li>
						<span class="ArticleSection_ListBriefDescription">
								<span class="ArticleSection_ListBriefDescription">Delete characters from string 1 which are present in string 2</span>
						</span>
				</li>
				<li>
						<span class="ArticleSection_ListBriefDescription">
								<span class="ArticleSection_ListBriefDescription"> An array of pointers to (very long) strings. Find pointers to the (lexicographically) smallest and largest strings</span>
						</span>
				</li>
				<li>
						<span class="ArticleSection_ListBriefDescription">
								<span class="ArticleSection_ListBriefDescription">Given a sequence of characters. How will you convert the lower case characters to upper case characters.</span>
						</span>
				</li>
		</ol>
<img src ="http://www.cppblog.com/ailab/aggbug/15517.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ailab/" target="_blank">ailab</a> 2006-11-21 21:58 <a href="http://www.cppblog.com/ailab/archive/2006/11/21/15517.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>dream come true </title><link>http://www.cppblog.com/ailab/archive/2006/11/20/15482.html</link><dc:creator>ailab</dc:creator><author>ailab</author><pubDate>Mon, 20 Nov 2006 15:32:00 GMT</pubDate><guid>http://www.cppblog.com/ailab/archive/2006/11/20/15482.html</guid><wfw:comment>http://www.cppblog.com/ailab/comments/15482.html</wfw:comment><comments>http://www.cppblog.com/ailab/archive/2006/11/20/15482.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ailab/comments/commentRss/15482.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ailab/services/trackbacks/15482.html</trackback:ping><description><![CDATA[
		<p>两个链表是否相交，如果相交，找出第一个开始相交的节点</p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">node </span>
				<span style="COLOR: #000000">*</span>
				<span style="COLOR: #000000">list(node </span>
				<span style="COLOR: #000000">*</span>
				<span style="COLOR: #000000">list1,node </span>
				<span style="COLOR: #000000">*</span>
				<span style="COLOR: #000000">list2)<br /><img id="Codehighlighter1_36_737_Open_Image" onclick="this.style.display='none'; Codehighlighter1_36_737_Open_Text.style.display='none'; Codehighlighter1_36_737_Closed_Image.style.display='inline'; Codehighlighter1_36_737_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_36_737_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_36_737_Closed_Text.style.display='none'; Codehighlighter1_36_737_Open_Image.style.display='inline'; Codehighlighter1_36_737_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_36_737_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cppblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_36_737_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /> </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">(list1 </span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">||</span>
						<span style="COLOR: #000000"> list2 </span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /> </span>
						<span style="COLOR: #0000ff">int</span>
						<span style="COLOR: #000000"> len1 </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">,len2 </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">0</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /> node </span>
						<span style="COLOR: #000000">*</span>
						<span style="COLOR: #000000">p </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> list1,</span>
						<span style="COLOR: #000000">*</span>
						<span style="COLOR: #000000">q </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> list2;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /> </span>
						<span style="COLOR: #0000ff">while</span>
						<span style="COLOR: #000000">(p</span>
						<span style="COLOR: #000000">-&gt;</span>
						<span style="COLOR: #000000">next </span>
						<span style="COLOR: #000000">!=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000">)<br /><img id="Codehighlighter1_170_217_Open_Image" onclick="this.style.display='none'; Codehighlighter1_170_217_Open_Text.style.display='none'; Codehighlighter1_170_217_Closed_Image.style.display='inline'; Codehighlighter1_170_217_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_170_217_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_170_217_Closed_Text.style.display='none'; Codehighlighter1_170_217_Open_Image.style.display='inline'; Codehighlighter1_170_217_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />   </span>
						<span id="Codehighlighter1_170_217_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cppblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_170_217_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        len1 </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        p </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">-&gt;</span>
								<span style="COLOR: #000000">next;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span>
						<span style="COLOR: #0000ff">while</span>
						<span style="COLOR: #000000">(q</span>
						<span style="COLOR: #000000">-&gt;</span>
						<span style="COLOR: #000000">next </span>
						<span style="COLOR: #000000">!=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000">)<br /><img id="Codehighlighter1_246_286_Open_Image" onclick="this.style.display='none'; Codehighlighter1_246_286_Open_Text.style.display='none'; Codehighlighter1_246_286_Closed_Image.style.display='inline'; Codehighlighter1_246_286_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_246_286_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_246_286_Closed_Text.style.display='none'; Codehighlighter1_246_286_Open_Image.style.display='inline'; Codehighlighter1_246_286_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />  </span>
						<span id="Codehighlighter1_246_286_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cppblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_246_286_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />      len2 </span>
								<span style="COLOR: #000000">++</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />      q </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> q</span>
								<span style="COLOR: #000000">-&gt;</span>
								<span style="COLOR: #000000">next;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">(p </span>
						<span style="COLOR: #000000">!=</span>
						<span style="COLOR: #000000"> q)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  len1 </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  len2 </span>
						<span style="COLOR: #000000">++</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  p </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> list1;q </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> list2;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">(len1 </span>
						<span style="COLOR: #000000">&gt;</span>
						<span style="COLOR: #000000"> len2 )<br /><img id="Codehighlighter1_386_539_Open_Image" onclick="this.style.display='none'; Codehighlighter1_386_539_Open_Text.style.display='none'; Codehighlighter1_386_539_Closed_Image.style.display='inline'; Codehighlighter1_386_539_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_386_539_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_386_539_Closed_Text.style.display='none'; Codehighlighter1_386_539_Open_Image.style.display='inline'; Codehighlighter1_386_539_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />  </span>
						<span id="Codehighlighter1_386_539_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cppblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_386_539_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />       </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> diff </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> len1 </span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000"> len2;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />       p </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> list1;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />       </span>
								<span style="COLOR: #0000ff">while</span>
								<span style="COLOR: #000000">(diff </span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">&amp;&amp;</span>
								<span style="COLOR: #000000"> p</span>
								<span style="COLOR: #000000">!=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">null</span>
								<span style="COLOR: #000000">;)<br /><img id="Codehighlighter1_481_533_Open_Image" onclick="this.style.display='none'; Codehighlighter1_481_533_Open_Text.style.display='none'; Codehighlighter1_481_533_Closed_Image.style.display='inline'; Codehighlighter1_481_533_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_481_533_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_481_533_Closed_Text.style.display='none'; Codehighlighter1_481_533_Open_Image.style.display='inline'; Codehighlighter1_481_533_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_481_533_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										<img src="http://www.cppblog.com/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_481_533_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />         p </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> p</span>
										<span style="COLOR: #000000">-&gt;</span>
										<span style="COLOR: #000000">next;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />         diff </span>
										<span style="COLOR: #000000">--</span>
										<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />          }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span>
						<span style="COLOR: #0000ff">else</span>
						<span style="COLOR: #000000"> <br /><img id="Codehighlighter1_550_670_Open_Image" onclick="this.style.display='none'; Codehighlighter1_550_670_Open_Text.style.display='none'; Codehighlighter1_550_670_Closed_Image.style.display='inline'; Codehighlighter1_550_670_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_550_670_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_550_670_Closed_Text.style.display='none'; Codehighlighter1_550_670_Open_Image.style.display='inline'; Codehighlighter1_550_670_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span>
						<span id="Codehighlighter1_550_670_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cppblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_550_670_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />       </span>
								<span style="COLOR: #0000ff">int</span>
								<span style="COLOR: #000000"> diff </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> len2 </span>
								<span style="COLOR: #000000">-</span>
								<span style="COLOR: #000000"> len1;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />       q </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> list2;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />       </span>
								<span style="COLOR: #0000ff">while</span>
								<span style="COLOR: #000000">(diff </span>
								<span style="COLOR: #000000">&gt;</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">&amp;&amp;</span>
								<span style="COLOR: #000000"> q </span>
								<span style="COLOR: #000000">!=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">null</span>
								<span style="COLOR: #000000">)<br /><img id="Codehighlighter1_645_666_Open_Image" onclick="this.style.display='none'; Codehighlighter1_645_666_Open_Text.style.display='none'; Codehighlighter1_645_666_Closed_Image.style.display='inline'; Codehighlighter1_645_666_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_645_666_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_645_666_Closed_Text.style.display='none'; Codehighlighter1_645_666_Open_Image.style.display='inline'; Codehighlighter1_645_666_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_645_666_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										<img src="http://www.cppblog.com/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_645_666_Open_Text">
										<span style="COLOR: #000000">{diff </span>
										<span style="COLOR: #000000">--</span>
										<span style="COLOR: #000000">; q</span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> q</span>
										<span style="COLOR: #000000">-&gt;</span>
										<span style="COLOR: #000000">next;}</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />  }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" /> </span>
						<span style="COLOR: #0000ff">while</span>
						<span style="COLOR: #000000">(p </span>
						<span style="COLOR: #000000">!=</span>
						<span style="COLOR: #000000"> q)<br /><img id="Codehighlighter1_689_719_Open_Image" onclick="this.style.display='none'; Codehighlighter1_689_719_Open_Text.style.display='none'; Codehighlighter1_689_719_Closed_Image.style.display='inline'; Codehighlighter1_689_719_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_689_719_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_689_719_Closed_Text.style.display='none'; Codehighlighter1_689_719_Open_Image.style.display='inline'; Codehighlighter1_689_719_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span>
						<span id="Codehighlighter1_689_719_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cppblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_689_719_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   p </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> p</span>
								<span style="COLOR: #000000">-&gt;</span>
								<span style="COLOR: #000000">next;q</span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> q</span>
								<span style="COLOR: #000000">-&gt;</span>
								<span style="COLOR: #000000">next;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" /> }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> p<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    <br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
		</div>
<img src ="http://www.cppblog.com/ailab/aggbug/15482.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ailab/" target="_blank">ailab</a> 2006-11-20 23:32 <a href="http://www.cppblog.com/ailab/archive/2006/11/20/15482.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>dream come true 5!</title><link>http://www.cppblog.com/ailab/archive/2006/11/20/15481.html</link><dc:creator>ailab</dc:creator><author>ailab</author><pubDate>Mon, 20 Nov 2006 14:11:00 GMT</pubDate><guid>http://www.cppblog.com/ailab/archive/2006/11/20/15481.html</guid><wfw:comment>http://www.cppblog.com/ailab/comments/15481.html</wfw:comment><comments>http://www.cppblog.com/ailab/archive/2006/11/20/15481.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ailab/comments/commentRss/15481.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ailab/services/trackbacks/15481.html</trackback:ping><description><![CDATA[reverse list <br />recursion and none-recursion<br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">node </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">reverse_list(node </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">head)<br /><img id="Codehighlighter1_31_318_Open_Image" onclick="this.style.display='none'; Codehighlighter1_31_318_Open_Text.style.display='none'; Codehighlighter1_31_318_Closed_Image.style.display='inline'; Codehighlighter1_31_318_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_31_318_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_31_318_Closed_Text.style.display='none'; Codehighlighter1_31_318_Open_Image.style.display='inline'; Codehighlighter1_31_318_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span id="Codehighlighter1_31_318_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_31_318_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(head </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">||</span><span style="COLOR: #000000"> head</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">next </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />      </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> head;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  node </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">cur </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> head</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">next;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  node </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">pre </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> head;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  node </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">next </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(cur </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">)<br /><img id="Codehighlighter1_183_267_Open_Image" onclick="this.style.display='none'; Codehighlighter1_183_267_Open_Text.style.display='none'; Codehighlighter1_183_267_Closed_Image.style.display='inline'; Codehighlighter1_183_267_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_183_267_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_183_267_Closed_Text.style.display='none'; Codehighlighter1_183_267_Open_Image.style.display='inline'; Codehighlighter1_183_267_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />  </span><span id="Codehighlighter1_183_267_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_183_267_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />     next </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> cur</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">next;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />     cur</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">next </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> pre;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />     pre </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> cur;  <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />     cur </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> next;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />  }</span></span><span style="COLOR: #000000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  head</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">next </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  head </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> pre;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  reurn head;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div><br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">node </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">reverse_list(node </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">head)<br /><img id="Codehighlighter1_31_280_Open_Image" onclick="this.style.display='none'; Codehighlighter1_31_280_Open_Text.style.display='none'; Codehighlighter1_31_280_Closed_Image.style.display='inline'; Codehighlighter1_31_280_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_31_280_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_31_280_Closed_Text.style.display='none'; Codehighlighter1_31_280_Open_Image.style.display='inline'; Codehighlighter1_31_280_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span id="Codehighlighter1_31_280_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_31_280_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(head </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">||</span><span style="COLOR: #000000"> head</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">next </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> head;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  node </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">cur </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> head</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">next;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  node </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">next </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  head</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">next </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(cur </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">)<br /><img id="Codehighlighter1_181_260_Open_Image" onclick="this.style.display='none'; Codehighlighter1_181_260_Open_Text.style.display='none'; Codehighlighter1_181_260_Closed_Image.style.display='inline'; Codehighlighter1_181_260_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_181_260_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_181_260_Closed_Text.style.display='none'; Codehighlighter1_181_260_Open_Image.style.display='inline'; Codehighlighter1_181_260_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span><span id="Codehighlighter1_181_260_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_181_260_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    next </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> cur</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">next;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    cur</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">next </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> head;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    head </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> cur;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    cur </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> next;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" /> }</span></span><span style="COLOR: #000000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> head;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  <br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div><img src ="http://www.cppblog.com/ailab/aggbug/15481.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ailab/" target="_blank">ailab</a> 2006-11-20 22:11 <a href="http://www.cppblog.com/ailab/archive/2006/11/20/15481.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>dream come true! </title><link>http://www.cppblog.com/ailab/archive/2006/11/20/15480.html</link><dc:creator>ailab</dc:creator><author>ailab</author><pubDate>Mon, 20 Nov 2006 14:04:00 GMT</pubDate><guid>http://www.cppblog.com/ailab/archive/2006/11/20/15480.html</guid><wfw:comment>http://www.cppblog.com/ailab/comments/15480.html</wfw:comment><comments>http://www.cppblog.com/ailab/archive/2006/11/20/15480.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ailab/comments/commentRss/15480.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ailab/services/trackbacks/15480.html</trackback:ping><description><![CDATA[
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #000000">node </span>
				<span style="COLOR: #000000">*</span>
				<span style="COLOR: #000000">merge(node </span>
				<span style="COLOR: #000000">*</span>
				<span style="COLOR: #000000">head1,node </span>
				<span style="COLOR: #000000">*</span>
				<span style="COLOR: #000000">head2)<br /><img id="Codehighlighter1_37_878_Open_Image" onclick="this.style.display='none'; Codehighlighter1_37_878_Open_Text.style.display='none'; Codehighlighter1_37_878_Closed_Image.style.display='inline'; Codehighlighter1_37_878_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_37_878_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_37_878_Closed_Text.style.display='none'; Codehighlighter1_37_878_Open_Image.style.display='inline'; Codehighlighter1_37_878_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_37_878_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cppblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_37_878_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">(head1 </span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />     </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> head2;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">(head2 </span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />     </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> head1;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  reverse_list(</span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000">head2);<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  node </span>
						<span style="COLOR: #000000">*</span>
						<span style="COLOR: #000000">head3 </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000">,</span>
						<span style="COLOR: #000000">*</span>
						<span style="COLOR: #000000">cur </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  node </span>
						<span style="COLOR: #000000">*</span>
						<span style="COLOR: #000000">p </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> head1,</span>
						<span style="COLOR: #000000">*</span>
						<span style="COLOR: #000000">q </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> head2;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span>
						<span style="COLOR: #0000ff">while</span>
						<span style="COLOR: #000000">(p </span>
						<span style="COLOR: #000000">!=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #000000">&amp;&amp;</span>
						<span style="COLOR: #000000"> q </span>
						<span style="COLOR: #000000">!=</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000">)<br /><img id="Codehighlighter1_239_783_Open_Image" onclick="this.style.display='none'; Codehighlighter1_239_783_Open_Text.style.display='none'; Codehighlighter1_239_783_Closed_Image.style.display='inline'; Codehighlighter1_239_783_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_239_783_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_239_783_Closed_Text.style.display='none'; Codehighlighter1_239_783_Open_Image.style.display='inline'; Codehighlighter1_239_783_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />  </span>
						<span id="Codehighlighter1_239_783_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cppblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_239_783_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000">(p</span>
								<span style="COLOR: #000000">-&gt;</span>
								<span style="COLOR: #000000">value </span>
								<span style="COLOR: #000000">&lt;</span>
								<span style="COLOR: #000000"> q</span>
								<span style="COLOR: #000000">-&gt;</span>
								<span style="COLOR: #000000">value)<br /><img id="Codehighlighter1_273_494_Open_Image" onclick="this.style.display='none'; Codehighlighter1_273_494_Open_Text.style.display='none'; Codehighlighter1_273_494_Closed_Image.style.display='inline'; Codehighlighter1_273_494_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_273_494_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_273_494_Closed_Text.style.display='none'; Codehighlighter1_273_494_Open_Image.style.display='inline'; Codehighlighter1_273_494_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
								<span id="Codehighlighter1_273_494_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										<img src="http://www.cppblog.com/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_273_494_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />       </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000">(head3 </span>
										<span style="COLOR: #000000">==</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">null</span>
										<span style="COLOR: #000000">)<br /><img id="Codehighlighter1_308_385_Open_Image" onclick="this.style.display='none'; Codehighlighter1_308_385_Open_Text.style.display='none'; Codehighlighter1_308_385_Closed_Image.style.display='inline'; Codehighlighter1_308_385_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_308_385_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_308_385_Closed_Text.style.display='none'; Codehighlighter1_308_385_Open_Image.style.display='inline'; Codehighlighter1_308_385_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
										<span id="Codehighlighter1_308_385_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
												<img src="http://www.cppblog.com/images/dot.gif" />
										</span>
										<span id="Codehighlighter1_308_385_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />           head3 </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> p;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />           cur </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> p;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />           p </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> p</span>
												<span style="COLOR: #000000">-&gt;</span>
												<span style="COLOR: #000000">next;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />         }</span>
										</span>
										<span style="COLOR: #000000">
												<br />
												<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
										<span style="COLOR: #0000ff">else</span>
										<span style="COLOR: #000000">
												<br />
												<img id="Codehighlighter1_408_486_Open_Image" onclick="this.style.display='none'; Codehighlighter1_408_486_Open_Text.style.display='none'; Codehighlighter1_408_486_Closed_Image.style.display='inline'; Codehighlighter1_408_486_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
												<img id="Codehighlighter1_408_486_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_408_486_Closed_Text.style.display='none'; Codehighlighter1_408_486_Open_Image.style.display='inline'; Codehighlighter1_408_486_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
										<span id="Codehighlighter1_408_486_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
												<img src="http://www.cppblog.com/images/dot.gif" />
										</span>
										<span id="Codehighlighter1_408_486_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />          cur</span>
												<span style="COLOR: #000000">-&gt;</span>
												<span style="COLOR: #000000">next </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> p;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />          cur </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> p;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />          p </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> p</span>
												<span style="COLOR: #000000">-&gt;</span>
												<span style="COLOR: #000000">next;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />         }</span>
										</span>
										<span style="COLOR: #000000">
												<br />
												<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />      }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />     </span>
								<span style="COLOR: #0000ff">else</span>
								<span style="COLOR: #000000">
										<br />
										<img id="Codehighlighter1_512_778_Open_Image" onclick="this.style.display='none'; Codehighlighter1_512_778_Open_Text.style.display='none'; Codehighlighter1_512_778_Closed_Image.style.display='inline'; Codehighlighter1_512_778_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
										<img id="Codehighlighter1_512_778_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_512_778_Closed_Text.style.display='none'; Codehighlighter1_512_778_Open_Image.style.display='inline'; Codehighlighter1_512_778_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />      </span>
								<span id="Codehighlighter1_512_778_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										<img src="http://www.cppblog.com/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_512_778_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />           </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000">(head3 </span>
										<span style="COLOR: #000000">==</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">null</span>
										<span style="COLOR: #000000">)<br /><img id="Codehighlighter1_554_640_Open_Image" onclick="this.style.display='none'; Codehighlighter1_554_640_Open_Text.style.display='none'; Codehighlighter1_554_640_Closed_Image.style.display='inline'; Codehighlighter1_554_640_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_554_640_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_554_640_Closed_Text.style.display='none'; Codehighlighter1_554_640_Open_Image.style.display='inline'; Codehighlighter1_554_640_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />           </span>
										<span id="Codehighlighter1_554_640_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
												<img src="http://www.cppblog.com/images/dot.gif" />
										</span>
										<span id="Codehighlighter1_554_640_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />             head3 </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> q;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />             cur </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> q;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />             q </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> q</span>
												<span style="COLOR: #000000">-&gt;</span>
												<span style="COLOR: #000000">next;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
										</span>
										<span style="COLOR: #000000">
												<br />
												<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />           </span>
										<span style="COLOR: #0000ff">else</span>
										<span style="COLOR: #000000">
												<br />
												<img id="Codehighlighter1_671_768_Open_Image" onclick="this.style.display='none'; Codehighlighter1_671_768_Open_Text.style.display='none'; Codehighlighter1_671_768_Closed_Image.style.display='inline'; Codehighlighter1_671_768_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
												<img id="Codehighlighter1_671_768_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_671_768_Closed_Text.style.display='none'; Codehighlighter1_671_768_Open_Image.style.display='inline'; Codehighlighter1_671_768_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />             </span>
										<span id="Codehighlighter1_671_768_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
												<img src="http://www.cppblog.com/images/dot.gif" />
										</span>
										<span id="Codehighlighter1_671_768_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />               cur</span>
												<span style="COLOR: #000000">-&gt;</span>
												<span style="COLOR: #000000">next </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> q;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />               cur </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> q;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />               q</span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000">q</span>
												<span style="COLOR: #000000">-&gt;</span>
												<span style="COLOR: #000000">next;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />               }</span>
										</span>
										<span style="COLOR: #000000">
												<br />
												<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />   }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">(p </span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />      cur</span>
						<span style="COLOR: #000000">-&gt;</span>
						<span style="COLOR: #000000">next </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> q;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">(q </span>
						<span style="COLOR: #000000">==</span>
						<span style="COLOR: #000000"> </span>
						<span style="COLOR: #0000ff">null</span>
						<span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />      cur</span>
						<span style="COLOR: #000000">-&gt;</span>
						<span style="COLOR: #000000">next </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> p;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />   </span>
						<span style="COLOR: #0000ff">return</span>
						<span style="COLOR: #000000"> head3;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
		</div>
<img src ="http://www.cppblog.com/ailab/aggbug/15480.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ailab/" target="_blank">ailab</a> 2006-11-20 22:04 <a href="http://www.cppblog.com/ailab/archive/2006/11/20/15480.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>dream come true!(4) strstr</title><link>http://www.cppblog.com/ailab/archive/2006/11/20/15478.html</link><dc:creator>ailab</dc:creator><author>ailab</author><pubDate>Mon, 20 Nov 2006 13:50:00 GMT</pubDate><guid>http://www.cppblog.com/ailab/archive/2006/11/20/15478.html</guid><wfw:comment>http://www.cppblog.com/ailab/comments/15478.html</wfw:comment><comments>http://www.cppblog.com/ailab/archive/2006/11/20/15478.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ailab/comments/commentRss/15478.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ailab/services/trackbacks/15478.html</trackback:ping><description><![CDATA[there are many implentations<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">strstr(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">str,</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">sub)<br /><img id="Codehighlighter1_46_335_Open_Image" onclick="this.style.display='none'; Codehighlighter1_46_335_Open_Text.style.display='none'; Codehighlighter1_46_335_Closed_Image.style.display='inline'; Codehighlighter1_46_335_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_46_335_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_46_335_Closed_Text.style.display='none'; Codehighlighter1_46_335_Open_Image.style.display='inline'; Codehighlighter1_46_335_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span id="Codehighlighter1_46_335_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_46_335_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(str </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">||</span><span style="COLOR: #000000"> sub </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">p </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> str;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">q </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> sub;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">str </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">\0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">sub </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">\0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br /><img id="Codehighlighter1_186_275_Open_Image" onclick="this.style.display='none'; Codehighlighter1_186_275_Open_Text.style.display='none'; Codehighlighter1_186_275_Closed_Image.style.display='inline'; Codehighlighter1_186_275_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_186_275_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_186_275_Closed_Text.style.display='none'; Codehighlighter1_186_275_Open_Image.style.display='inline'; Codehighlighter1_186_275_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />  </span><span id="Codehighlighter1_186_275_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_186_275_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />     </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">str</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">sub</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br /><img id="Codehighlighter1_220_270_Open_Image" onclick="this.style.display='none'; Codehighlighter1_220_270_Open_Text.style.display='none'; Codehighlighter1_220_270_Closed_Image.style.display='inline'; Codehighlighter1_220_270_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_220_270_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_220_270_Closed_Text.style.display='none'; Codehighlighter1_220_270_Open_Image.style.display='inline'; Codehighlighter1_220_270_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />      </span><span id="Codehighlighter1_220_270_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_220_270_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />          str </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">p;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />          sub </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> q;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span></span><span style="COLOR: #000000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />   }</span></span><span style="COLOR: #000000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">sub </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">\0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> p;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">strstr(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">str,</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">sub)<br /><img id="Codehighlighter1_46_374_Open_Image" onclick="this.style.display='none'; Codehighlighter1_46_374_Open_Text.style.display='none'; Codehighlighter1_46_374_Closed_Image.style.display='inline'; Codehighlighter1_46_374_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_46_374_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_46_374_Closed_Text.style.display='none'; Codehighlighter1_46_374_Open_Image.style.display='inline'; Codehighlighter1_46_374_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span id="Codehighlighter1_46_374_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_46_374_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(str </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">||</span><span style="COLOR: #000000"> sub </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">p </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> str;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">q </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> sub;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">str </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">\0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000"> ;str</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br /><img id="Codehighlighter1_175_373_Open_Image" onclick="this.style.display='none'; Codehighlighter1_175_373_Open_Text.style.display='none'; Codehighlighter1_175_373_Closed_Image.style.display='inline'; Codehighlighter1_175_373_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_175_373_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_175_373_Closed_Text.style.display='none'; Codehighlighter1_175_373_Open_Image.style.display='inline'; Codehighlighter1_175_373_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />  </span><span id="Codehighlighter1_175_373_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_175_373_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">str </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">sub)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />      </span><span style="COLOR: #0000ff">continue</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    p </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> str;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)<br /><img id="Codehighlighter1_244_356_Open_Image" onclick="this.style.display='none'; Codehighlighter1_244_356_Open_Text.style.display='none'; Codehighlighter1_244_356_Closed_Image.style.display='inline'; Codehighlighter1_244_356_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_244_356_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_244_356_Closed_Text.style.display='none'; Codehighlighter1_244_356_Open_Image.style.display='inline'; Codehighlighter1_244_356_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span id="Codehighlighter1_244_356_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_244_356_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">sub </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">\0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />           </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> str;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">p</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">sub</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />           </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />         <br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />      }</span></span><span style="COLOR: #000000"> <br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />     sub </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> q;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />}</span></span></span></div><img src ="http://www.cppblog.com/ailab/aggbug/15478.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ailab/" target="_blank">ailab</a> 2006-11-20 21:50 <a href="http://www.cppblog.com/ailab/archive/2006/11/20/15478.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>dream come true!(3)</title><link>http://www.cppblog.com/ailab/archive/2006/11/20/15474.html</link><dc:creator>ailab</dc:creator><author>ailab</author><pubDate>Mon, 20 Nov 2006 13:20:00 GMT</pubDate><guid>http://www.cppblog.com/ailab/archive/2006/11/20/15474.html</guid><wfw:comment>http://www.cppblog.com/ailab/comments/15474.html</wfw:comment><comments>http://www.cppblog.com/ailab/archive/2006/11/20/15474.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/ailab/comments/commentRss/15474.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/ailab/services/trackbacks/15474.html</trackback:ping><description><![CDATA[给定数组a[0:n-1]以及一个正整数k（0&lt;=k&lt;=n-1），设计一个算法，将子数组a[0:k]和<br />a[k+1:n-1]交换位置，要求算法在最坏的情况下耗时O(n)，且用到的辅助空间为O(1)。<br /><br />in fact,the essence of above question is "revers two times"<br />(a'b')' = ba;<br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> reverse(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">a,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> n,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> k)<br /><img id="Codehighlighter1_33_159_Open_Image" onclick="this.style.display='none'; Codehighlighter1_33_159_Open_Text.style.display='none'; Codehighlighter1_33_159_Closed_Image.style.display='inline'; Codehighlighter1_33_159_Closed_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_33_159_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_33_159_Closed_Text.style.display='none'; Codehighlighter1_33_159_Open_Image.style.display='inline'; Codehighlighter1_33_159_Open_Text.style.display='inline';" src="http://www.cppblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span id="Codehighlighter1_33_159_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/images/dot.gif" /></span><span id="Codehighlighter1_33_159_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(a </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">||</span><span style="COLOR: #000000"> n </span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">||</span><span style="COLOR: #000000"> k </span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"> n)<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">;<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  revers_array(a,</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,n</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  revers_array(a,</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,k);<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  revers_array(a,k</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,n</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br /><img src="http://www.cppblog.com/images/OutliningIndicators/InBlock.gif" align="top" />  <br /><img src="http://www.cppblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div><img src ="http://www.cppblog.com/ailab/aggbug/15474.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ailab/" target="_blank">ailab</a> 2006-11-20 21:20 <a href="http://www.cppblog.com/ailab/archive/2006/11/20/15474.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>