﻿<?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>语源科技BlogJava-javaGrowing</title><link>http://www.blogjava.net/juhongtao/</link><description /><language>zh-cn</language><lastBuildDate>Tue, 12 May 2026 21:42:12 GMT</lastBuildDate><pubDate>Tue, 12 May 2026 21:42:12 GMT</pubDate><ttl>60</ttl><item><title>win2003不能识别移动硬盘的解决方法 </title><link>http://www.blogjava.net/juhongtao/archive/2008/11/01/238053.html</link><dc:creator>javaGrowing</dc:creator><author>javaGrowing</author><pubDate>Sat, 01 Nov 2008 07:19:00 GMT</pubDate><guid>http://www.blogjava.net/juhongtao/archive/2008/11/01/238053.html</guid><wfw:comment>http://www.blogjava.net/juhongtao/comments/238053.html</wfw:comment><comments>http://www.blogjava.net/juhongtao/archive/2008/11/01/238053.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/juhongtao/comments/commentRss/238053.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/juhongtao/services/trackbacks/238053.html</trackback:ping><description><![CDATA[单击“开始→运行”，在“打开”框中键入“MOUNTVOL   /E”，然后单击“确定”按钮，重新启动电脑。<img src ="http://www.blogjava.net/juhongtao/aggbug/238053.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/juhongtao/" target="_blank">javaGrowing</a> 2008-11-01 15:19 <a href="http://www.blogjava.net/juhongtao/archive/2008/11/01/238053.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>maven</title><link>http://www.blogjava.net/juhongtao/archive/2008/09/03/226735.html</link><dc:creator>javaGrowing</dc:creator><author>javaGrowing</author><pubDate>Wed, 03 Sep 2008 10:07:00 GMT</pubDate><guid>http://www.blogjava.net/juhongtao/archive/2008/09/03/226735.html</guid><wfw:comment>http://www.blogjava.net/juhongtao/comments/226735.html</wfw:comment><comments>http://www.blogjava.net/juhongtao/archive/2008/09/03/226735.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/juhongtao/comments/commentRss/226735.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/juhongtao/services/trackbacks/226735.html</trackback:ping><description><![CDATA[
		<table class="confluenceTable">
				<tbody>
						<tr>
								<th class="confluenceTh">Archetype</th>
								<th class="confluenceTh">Command</th>
						</tr>
						<tr>
								<td class="confluenceTd">
										<b>JSF Basic</b>
								</td>
								<td class="confluenceTd">mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-jsf -DremoteRepositories=<span class="nobr"><a href="http://static.appfuse.org/releases" rel="nofollow">http://static.appfuse.org/releases<sup><img class="rendericon" height="7" alt="" src="http://appfuse.org/images/icons/linkext7.gif" width="7" align="absMiddle" border="0" /></sup></a></span> -DarchetypeVersion=2.0.2 -DgroupId=com.mycompany.app -DartifactId=myproject</td>
						</tr>
						<tr>
								<td class="confluenceTd">
										<b>Spring MVC Basic</b>
								</td>
								<td class="confluenceTd">mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-spring -DremoteRepositories=<span class="nobr"><a href="http://static.appfuse.org/releases" rel="nofollow">http://static.appfuse.org/releases<sup><img class="rendericon" height="7" alt="" src="http://appfuse.org/images/icons/linkext7.gif" width="7" align="absMiddle" border="0" /></sup></a></span> -DarchetypeVersion=2.0.2 -DgroupId=com.mycompany.app -DartifactId=myproject</td>
						</tr>
						<tr>
								<td class="confluenceTd">
										<b>Struts 2 Basic</b>
								</td>
								<td class="confluenceTd">mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=<span class="nobr"><a href="http://static.appfuse.org/releases" rel="nofollow">http://static.appfuse.org/releases<sup><img class="rendericon" height="7" alt="" src="http://appfuse.org/images/icons/linkext7.gif" width="7" align="absMiddle" border="0" /></sup></a></span> -DarchetypeVersion=2.0.2 -DgroupId=com.mycompany.app -DartifactId=myproject</td>
						</tr>
						<tr>
								<td class="confluenceTd">
										<b>Tapestry Basic</b>
								</td>
								<td class="confluenceTd">mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-tapestry -DremoteRepositories=<span class="nobr"><a href="http://static.appfuse.org/releases" rel="nofollow">http://static.appfuse.org/releases<sup><img class="rendericon" height="7" alt="" src="http://appfuse.org/images/icons/linkext7.gif" width="7" align="absMiddle" border="0" /></sup></a></span> -DarchetypeVersion=2.0.2 -DgroupId=com.mycompany.app -DartifactId=myproject</td>
						</tr>
						<tr>
								<td class="confluenceTd">
										<b>JSF Modular</b>
								</td>
								<td class="confluenceTd">mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-modular-jsf -DremoteRepositories=<span class="nobr"><a href="http://static.appfuse.org/releases" rel="nofollow">http://static.appfuse.org/releases<sup><img class="rendericon" height="7" alt="" src="http://appfuse.org/images/icons/linkext7.gif" width="7" align="absMiddle" border="0" /></sup></a></span> -DarchetypeVersion=2.0.2 -DgroupId=com.mycompany.app -DartifactId=myproject</td>
						</tr>
						<tr>
								<td class="confluenceTd">
										<b>Spring MVC Modular</b>
								</td>
								<td class="confluenceTd">mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-modular-spring -DremoteRepositories=<span class="nobr"><a href="http://static.appfuse.org/releases" rel="nofollow">http://static.appfuse.org/releases<sup><img class="rendericon" height="7" alt="" src="http://appfuse.org/images/icons/linkext7.gif" width="7" align="absMiddle" border="0" /></sup></a></span> -DarchetypeVersion=2.0.2 -DgroupId=com.mycompany.app -DartifactId=myproject</td>
						</tr>
						<tr>
								<td class="confluenceTd">
										<b>Struts 2 Modular</b>
								</td>
								<td class="confluenceTd">mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-modular-struts -DremoteRepositories=<span class="nobr"><a href="http://static.appfuse.org/releases" rel="nofollow">http://static.appfuse.org/releases<sup><img class="rendericon" height="7" alt="" src="http://appfuse.org/images/icons/linkext7.gif" width="7" align="absMiddle" border="0" /></sup></a></span> -DarchetypeVersion=2.0.2 -DgroupId=com.mycompany.app -DartifactId=myproject</td>
						</tr>
						<tr>
								<td class="confluenceTd">
										<b>Tapestry Modular</b>
								</td>
								<td class="confluenceTd">mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-modular-tapestry -DremoteRepositories=<span class="nobr"><a href="http://static.appfuse.org/releases" rel="nofollow">http://static.appfuse.org/releases<sup><img class="rendericon" height="7" alt="" src="http://appfuse.org/images/icons/linkext7.gif" width="7" align="absMiddle" border="0" /></sup></a></span> -DarchetypeVersion=2.0.2 -DgroupId=com.mycompany.app -DartifactId=myproject</td>
						</tr>
						<tr>
								<td class="confluenceTd">
										<b>Core</b>
										<br clear="all" />(backend only) </td>
								<td class="confluenceTd">mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-core -DremoteRepositories=<span class="nobr"><a href="http://static.appfuse.org/releases" rel="nofollow">http://static.appfuse.org/releases<sup><img class="rendericon" height="7" alt="" src="http://appfuse.org/images/icons/linkext7.gif" width="7" align="absMiddle" border="0" /></sup></a></span> -DarchetypeVersion=2.0.2 -DgroupId=com.mycompany.app -DartifactId=myproject</td>
						</tr>
				</tbody>
		</table>
		<p>You should be able to run AppFuse immediately if you have a <span class="nobr"><a href="http://dev.mysql.com/downloads/mysql/5.0.html#downloads" rel="nofollow">MySQL 5.x<sup><img class="rendericon" height="7" alt="" src="http://appfuse.org/images/icons/linkext7.gif" width="7" align="absMiddle" border="0" /></sup></a></span> database installed and it's accessible to root using no password. If you'd prefer to use an embedded database, we've recently added <a title="Database Profiles" href="http://appfuse.org/display/APF/Database+Profiles">Database Profiles</a> for H2, HSQLDB, etc.</p>
		<table class="noteMacro" cellspacing="8" cellpadding="5" width="85%" align="center" border="0">
				<colgroup>
						<col width="24" />
						<col />
				</colgroup>
				<tbody>
						<tr>
								<td valign="top">
										<img height="16" alt="" src="http://appfuse.org/images/icons/emoticons/warning.gif" width="16" align="absMiddle" border="0" />
								</td>
								<td>
										<b class="strong">MySQL Security</b>
										<br />Running MySQL using root with no password is not the most secure thing to do. Once your database is created, you can change the root password using the command below: 
<div class="preformatted"><div class="preformattedContent"><pre>mysql --user=root --pass='' mysql -e "update user set password=password('newpw') where user='root'; flush privileges;"</pre></div></div><p>AppFuse uses the username "root" and a blank password by default. To change these values, modify the &lt;jdbc.username&gt; and &lt;jdbc.password&gt; properties in your project's pom.xml (at the bottom).</p></td>
						</tr>
				</tbody>
		</table>
		<h2>
				<a name="AppFuseQuickStart-Runyourapplication">
				</a>Run your application <a name="AppFuseQuickStart-run"></a></h2>
		<p>Running AppFuse is easy now. Once the archetype project is created, Maven will create and populate your database using the <span class="nobr"><a href="http://mojo.codehaus.org/maven-hibernate3/hibernate3-maven-plugin/" rel="nofollow">hibernate3<sup><img class="rendericon" height="7" alt="" src="http://appfuse.org/images/icons/linkext7.gif" width="7" align="absMiddle" border="0" /></sup></a></span> and <span class="nobr"><a href="http://mojo.codehaus.org/dbunit-maven-plugin/" rel="nofollow">dbunit<sup><img class="rendericon" height="7" alt="" src="http://appfuse.org/images/icons/linkext7.gif" width="7" align="absMiddle" border="0" /></sup></a></span> plugins, respectively. All you have to do is use Maven to run the Jetty container and view your application.</p>
		<ol>
				<li>Check your new project into source control, unless you have a good reason not to. <span class="nobr"><a href="http://code.google.com/hosting/" rel="nofollow">Google Code<sup><img class="rendericon" height="7" alt="" src="http://appfuse.org/images/icons/linkext7.gif" width="7" align="absMiddle" border="0" /></sup></a></span> has free Subversion hosting, as do many others. 
</li>
				<li>From the command line, <b>cd</b> into your new project's directory and run <b>mvn</b> to download JARs, Tomcat and run the integration tests in your project. Now is a good time to take a coffee break or grab a beer - downloading everything and running the tests can take 5-10 minutes. 
</li>
				<li>To view your application run <b>mvn jetty:run-war</b> from your project's directory (<span style="BACKGROUND: #ffd">for a <b>modular</b> project, you'll need to run <b>mvn jetty:run-war</b> from your project's <em>web</em> directory</span>). Maven will start Jetty and you should be able to view your application in your browser at <span class="nobr"><a href="http://localhost:8080/" rel="nofollow">http://localhost:8080<sup><img class="rendericon" height="7" alt="" src="http://appfuse.org/images/icons/linkext7.gif" width="7" align="absMiddle" border="0" /></sup></a></span>. 
<table class="tipMacro" cellspacing="8" cellpadding="5" width="85%" align="center" border="0"><colgroup><col width="24" /><col /></colgroup><tbody><tr><td valign="top"><img height="16" alt="" src="http://appfuse.org/images/icons/emoticons/check.gif" width="16" align="absMiddle" border="0" /></td><td>The default username/password for an admin user is <b>admin/admin</b>. For a regular user, use <b>user/user</b>.</td></tr></tbody></table></li>
				<li>To override files from AppFuse, run <b>mvn war:inplace</b>. This will extract the dependent WARs into <em>src/main/webapp</em>, where you can change files to your heart's content. When you have the war expanded in your source tree, you can run <b>mvn jetty:run</b>. This will allow you to change files on-the-fly and Jetty will reload them as needed. The only problem with this approach is you end up with an "exploded AppFuse" in your project, which won't bode well for upgrading. We recommend you check your project into source control before running <b>mvn war:inplace</b>. That way, it'll be easier for you to decide what needs to be checked in (over written) and what can be deleted. </li>
		</ol>
		<p>If you receive OutOfMemory errors when using <b>mvn jetty:run</b>, see <span class="nobr"><a href="http://www.nabble.com/mvn-jetty%3Arun-%3D%3E-OutOfMemoryError%3A-PermGen-space-tf3367253s2369.html" rel="nofollow">this mailing list thread<sup><img class="rendericon" height="7" alt="" src="http://appfuse.org/images/icons/linkext7.gif" width="7" align="absMiddle" border="0" /></sup></a></span>. </p>
		<p>You can change AppFuse from its "embedded mode" to full-source mode by running <b>mvn appfuse:full-source</b> from your project's root directory.</p>
		<table class="noteMacro" cellspacing="8" cellpadding="5" width="85%" align="center" border="0">
				<colgroup>
						<col width="24" />
						<col />
				</colgroup>
				<tbody>
						<tr>
								<td valign="top">
										<img height="16" alt="" src="http://appfuse.org/images/icons/emoticons/warning.gif" width="16" align="absMiddle" border="0" />
								</td>
								<td>
										<b class="strong">Bug with Ant 1.7.0</b>
										<br />Local repositories and projects on Windows platforms are held in directories whose paths contain no spaces. To fix this issue, modify your $M2_HOME/conf/settings.xml and change your localRepository to something like the following: 
<div class="preformatted"><div class="preformattedContent"><pre>&lt;localRepository&gt;c:\docume~1\username\.m2\repository&lt;/localRepository&gt; 
</pre></div></div></td>
						</tr>
				</tbody>
		</table>
		<table class="infoMacro" cellspacing="8" cellpadding="5" width="85%" align="center" border="0">
				<colgroup>
						<col width="24" />
						<col />
				</colgroup>
				<tbody>
						<tr>
								<td valign="top">
										<img height="16" alt="" src="http://appfuse.org/images/icons/emoticons/information.gif" width="16" align="absMiddle" border="0" />
								</td>
								<td>
										<b class="strong">Development Environment</b>
										<br />See <a title="Development Environment" href="http://appfuse.org/display/APF/Development+Environment">development environment</a> for detailed instructions on how to setup your computer to develop AppFuse-based applications.</td>
						</tr>
				</tbody>
		</table>
		<table class="tipMacro" cellspacing="8" cellpadding="5" width="85%" align="center" border="0">
				<colgroup>
						<col width="24" />
						<col />
				</colgroup>
				<tbody>
						<tr>
								<td valign="top">
										<img height="16" alt="" src="http://appfuse.org/images/icons/emoticons/check.gif" width="16" align="absMiddle" border="0" />
								</td>
								<td>
										<b class="strong">Changing database settings</b>
										<br />To change your MySQL database settings, simply change the &lt;jdbc.*&gt; properties at the bottom of your pom.xml. See <a title="Database Profiles" href="http://appfuse.org/display/APF/Database+Profiles">Database Profiles</a> to use a database other than MySQL</td>
						</tr>
				</tbody>
		</table>
		<br />
		<br />set MAVEN_OPTS=-Xmx512m -Xms512m -XX:MaxPermSize=512m<img src ="http://www.blogjava.net/juhongtao/aggbug/226735.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/juhongtao/" target="_blank">javaGrowing</a> 2008-09-03 18:07 <a href="http://www.blogjava.net/juhongtao/archive/2008/09/03/226735.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>request.getParameter("变量名")获取的字符串中原来的加号变成了空格，url传值   </title><link>http://www.blogjava.net/juhongtao/archive/2007/12/19/168639.html</link><dc:creator>javaGrowing</dc:creator><author>javaGrowing</author><pubDate>Wed, 19 Dec 2007 01:02:00 GMT</pubDate><guid>http://www.blogjava.net/juhongtao/archive/2007/12/19/168639.html</guid><wfw:comment>http://www.blogjava.net/juhongtao/comments/168639.html</wfw:comment><comments>http://www.blogjava.net/juhongtao/archive/2007/12/19/168639.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.blogjava.net/juhongtao/comments/commentRss/168639.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/juhongtao/services/trackbacks/168639.html</trackback:ping><description><![CDATA[今天我在调程序时，遇到了见郁闷的事，我用ajax从前台显示页面传字符串变量给处理页面，出现了件怪事，我想传的内容是abc+，但接收以后用System.out.println()输出是abc空格。反复测试好几遍，都是这个结果，真是令人郁闷。在网上搜了搜，找到了原因。<br />原因：   url中有些字符被转义，比如空格被编码成加号，于是传的参数明明是加号，获取的值却成了空格。如何解决呢？如果是通过url传递参数，应该对其进行必要的编码。<br />解决办法：<br />         在javascript中加入   function URLencode(sStr) <br />{<br />    return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/\//g,'%2F');<br />}<br />对字符串进行处理.如：var str=URLencode("abc+")<br /><img src ="http://www.blogjava.net/juhongtao/aggbug/168639.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/juhongtao/" target="_blank">javaGrowing</a> 2007-12-19 09:02 <a href="http://www.blogjava.net/juhongtao/archive/2007/12/19/168639.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SAP 月末结帐步骤</title><link>http://www.blogjava.net/juhongtao/archive/2007/12/18/168512.html</link><dc:creator>javaGrowing</dc:creator><author>javaGrowing</author><pubDate>Tue, 18 Dec 2007 08:03:00 GMT</pubDate><guid>http://www.blogjava.net/juhongtao/archive/2007/12/18/168512.html</guid><wfw:comment>http://www.blogjava.net/juhongtao/comments/168512.html</wfw:comment><comments>http://www.blogjava.net/juhongtao/archive/2007/12/18/168512.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/juhongtao/comments/commentRss/168512.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/juhongtao/services/trackbacks/168512.html</trackback:ping><description><![CDATA[

			The following processes including SD,MM,PP,FI,CO .<br /><br /><br />
SD Relevant Steps: <br />
1.Check if all delivery in due list have been processedVL06G (Could set
background jobs to automatically generate the billing due list for
posting) <br />
2.Check if all picking in due list have been processedVL06P <br />
3.Check if all goods issue in due list have been processedVL04 <br />
4.Check if all billed AR has been release to accountingVFX3 <br /><br />
PP Relevant Steps: <br />
1.Check if all back flash error has been solved (COGI Check every day this kind of problem and solved on time) <br />
2.Check if all production orders that will not be followed have been
finally  confirmed or technically closed. Do final confirmation even
small quantity  variance exist but we consider this order has finished <br />
3.Do technical close at month end for the orders will not be followed in the future <br />
4.Confirmation. Do not confirm any assembly scrap when do production order conf. <br /><br />
MM Relevant Steps <br />
1.Check if all goods movement has been booked in SAP <br />
2.GR/IR clearing accounts maintenance if needed <br />
3.Open the MM period for movement posting when new period starts MMPV <br /><br />
FI Relevant Steps <br />
1.Book all accounting entries for: <br />
- Accrued expense <br />
- Do recurring entry (prepayment, accrued expense, amortization) <br />
- Process G/L, vendor, customer balance &amp; open items <br />
- Cost allocations by FI <br />
2.AM Fixed asset depreciation run and period postingAFAB <br />
3.AM Periodic posting ASKB <br />
4.G/L,AR,AP balance check &amp; Open item clearing <br />
5.Foreign currency revaluation for bank/cash &amp; AR AP open items <br />
Bank/cash revaluation: F.06 <br />
AR AP open items: F.05 <br />
6.GR/IR clearing account regrouping process F.19 <br />
7.Automatic clearing for G/L accounts, vendor and customer F.13 <br /><br />
CO Relevant Steps <br />
1.Release standard cost estimate <br />
CK24Only when there are costing run to be released. <br />
2.Cost reallocation according to activity <br />
Distribution: CKV5 <br />
Assessment: KSU5 <br />
3.Cost splitting among activity KSS2 <br />
4.Actual activity price calculation KSII <br />
5.Production order revaluation with actual activity price CON2 <br />
6.WIP calculationfor the production orders KKAO <br />
7.Variance calculation for the production orders KKS1 <br />
8.Production / Costing orders settlement CO88/KO88 <br />
9.Material ledger closing &gt; MMPV first <br />
a.Create costing runCKRU00 <br />
b.Allow settlementCKMF_RUN <br />
c.Allow closing entriesCKMG_RUN <br />
d.Material selectionCKMB_RUN <br />
e.Determine costing sequenceCKMC_RUN <br />
f.Settle single levelCKMH_RUN <br />
g.Settle multi levelCKMM_RUN <br />
h.Post closingCKMI
			
			<img src ="http://www.blogjava.net/juhongtao/aggbug/168512.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/juhongtao/" target="_blank">javaGrowing</a> 2007-12-18 16:03 <a href="http://www.blogjava.net/juhongtao/archive/2007/12/18/168512.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>javascript 的几种排序方法</title><link>http://www.blogjava.net/juhongtao/archive/2007/07/23/131899.html</link><dc:creator>javaGrowing</dc:creator><author>javaGrowing</author><pubDate>Mon, 23 Jul 2007 08:23:00 GMT</pubDate><guid>http://www.blogjava.net/juhongtao/archive/2007/07/23/131899.html</guid><wfw:comment>http://www.blogjava.net/juhongtao/comments/131899.html</wfw:comment><comments>http://www.blogjava.net/juhongtao/archive/2007/07/23/131899.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/juhongtao/comments/commentRss/131899.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/juhongtao/services/trackbacks/131899.html</trackback:ping><description><![CDATA[
		<p>所谓排序，就是要整理文件中的记录，使之按关键字递增(或递减)次序排列起来。其确切定义如下：<br />　　输入：n个记录R<sub>1</sub>，R<sub>2</sub>，…，R<sub>n</sub>，其相应的关键字分别为K<sub>1</sub>，K<sub>2</sub>，…，K<sub>n</sub>。<br />　　输出：R<sub>il</sub>，R<sub>i2</sub>，…，R<sub>in</sub>，使得K<sub>i1</sub>≤K<sub>i2</sub>≤…≤K<sub>in</sub>。(或K<sub>i1</sub>≥K<sub>i2</sub>≥…≥K<sub>in</sub>)。</p>
		<p>    这里，我们简单介绍几种排序方法，直接插入排序、希儿排序、冒泡排序、快速排序、直接选择排序，文中所提及的代码在IE6下测试通过。</p>
		<p>
				<strong>直接插入排序基本思想</strong>
				<br />    假设待排序的记录存放在数组R[1..n]中。初始时，R[1]自成1个有序区，无序区为R[2..n]。从i=2起直至i=n为止，依次将R[i]插入当前的有序区R[1..i-1]中，生成含n个记录的有序区。</p>
		<p>    算法描述<br /><span class="code"><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> InsertSort(arr) { </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">插入排序-&gt;直接插入法排序</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> st </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Date();<br />  </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> temp, j;<br />  </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> i</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">; i</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">arr.length; i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br />   </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">((arr[i]) </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> (arr[i</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">])) {<br />    temp </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> arr[i];<br />    j </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> i</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">;<br />    </span><span style="color: rgb(0, 0, 255);">do</span><span style="color: rgb(0, 0, 0);"> {<br />     arr[j</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> arr[j];<br />     j</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">;<br />    }<br />    </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);"> (j</span><span style="color: rgb(0, 0, 0);">&gt;-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">&amp;&amp;</span><span style="color: rgb(0, 0, 0);"> (temp) </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> (arr[j]));<br />    arr[j</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> temp;<br />   }</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">endif</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">  }<br />  status </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Date() </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> st) </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> ' ms';<br />  </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> arr;<br /> }</span></div><br /></span></p>
		<p>
				<strong>希尔排序基本思想<br /></strong>　  先取一个小于n的整数d<sub>1</sub>作为第一个增量，把文件的全部记录分成d<sub>1</sub>个组。所有距离为d<sub>l</sub>的倍数的记录放在同一个组中。先在各组内进行直接插人排序；然后，取第二个增量d<sub>2</sub>&lt;d<sub>1</sub>重复上述的分组和排序，直至所取的增量d<sub>t</sub>=1(d<sub>t</sub>&lt;d<sub>t-l</sub>&lt;…&lt;d<sub>2</sub>&lt;d<sub>1</sub>)，即所有记录放在同一组中进行直接插入排序为止。<br />  　该方法实质上是一种分组插入方法。</p>
		<p>    算法描述<br /><span class="code"><p> </p><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> ShellSort(arr) { </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">插入排序-&gt;希儿排序</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> st </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Date();<br />  </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> increment </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> arr.length;<br />  </span><span style="color: rgb(0, 0, 255);">do</span><span style="color: rgb(0, 0, 0);"> {<br />   increment </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (increment</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">|</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">;<br />   arr </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> ShellPass(arr, increment);<br />  }<br />  </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);"> (increment </span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">)<br /><br />  status </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Date() </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> st) </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> ' ms';<br />  </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> arr;<br /> }<br /> </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> ShellPass(arr, d) { </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">希儿排序分段执行函数</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> temp, j;<br />  </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> i</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">d; i</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">arr.length; i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br />   </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">((arr[i]) </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> (arr[i</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">d])) {<br />    temp </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> arr[i]; j </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> i</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">d;<br />    </span><span style="color: rgb(0, 0, 255);">do</span><span style="color: rgb(0, 0, 0);"> {<br />     arr[j</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">d] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> arr[j];<br />     j </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> j</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">d;<br />    }<br />    </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);"> (j</span><span style="color: rgb(0, 0, 0);">&gt;-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">&amp;&amp;</span><span style="color: rgb(0, 0, 0);"> (temp) </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> (arr[j]));<br />    arr[j</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">d] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> temp;<br />   }</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">endif</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">  }<br />  </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> arr;<br /> }</span></div></span></p>
		<p>
				<strong>冒泡排序基本思想<br /></strong>   
将被排序的记录数组R[1..n]垂直排列，每个记录R[i]看作是重量为R[i].key的气泡。根据轻气泡不能在重气泡之下的原则，从下往上扫描数组
R：凡扫描到违反本原则的轻气泡，就使其向上"飘浮"。如此反复进行，直到最后任何两个气泡都是轻者在上，重者在下为止。<br /></p>
		<p>    算法描述<br /><span class="code"> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> BubbleSort(arr) { </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">交换排序-&gt;冒泡排序</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> st </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Date();<br />  </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> temp;<br />  </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> exchange;<br />  </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> i</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; i</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">arr.length; i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br />   exchange </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);">;<br />   </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> j</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">arr.length</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">; j</span><span style="color: rgb(0, 0, 0);">&gt;=</span><span style="color: rgb(0, 0, 0);">i; j</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">) {<br />    </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">((arr[j</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">]) </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> (arr[j])) {<br />     temp </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> arr[j</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">];<br />     arr[j</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> arr[j];<br />     arr[j] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> temp;<br />     exchange </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;<br />    }<br />   }<br />   </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">exchange) </span><span style="color: rgb(0, 0, 255);">break</span><span style="color: rgb(0, 0, 0);">;<br />  }<br />  status </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Date() </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> st) </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> ' ms';<br />  </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> arr;<br /> }</span></div></span></p>
		<p>
				<strong>快速排序基本思想<br /></strong>    将原问题分解为若干个规模更小但结构与原问题相似的子问题。递归地解这些子问题，然后将这些子问题的解组合为原问题的解。<br />   
在R[low..high]中任选一个记录作为基准(Pivot)，以此基准将当前无序区划分为左、右两个较小的子区间R[low..pivotpos-
1)和R[pivotpos+1..high]，并使左边子区间中所有记录的关键字均小于等于基准记录(不妨记为pivot)的关键字
pivot.key，右边的子区间中所有记录的关键字均大于等于pivot.key，而基准记录pivot则位于正确的位置(pivotpos)上，它无
须参加后续的排序。</p>
		<p>    算法描述<br /><span class="code"> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> QuickSort(arr) { </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">交换排序-&gt;快速排序</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (arguments.length</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">) {<br />   </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> low </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> arguments[</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">];<br />   </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> high </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> arguments[</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">];<br />  } </span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"> {<br />   </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> low </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br />   </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> high </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> arr.length</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">;<br />  }<br />  </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(low </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> high){<br />   </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> function Partition</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">   </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> low;<br />   </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> j </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> high;<br />   </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> pivot </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> arr[i];<br />   </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(i</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">j) {<br />    </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(i</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">j </span><span style="color: rgb(0, 0, 0);">&amp;&amp;</span><span style="color: rgb(0, 0, 0);"> arr[j]</span><span style="color: rgb(0, 0, 0);">&gt;=</span><span style="color: rgb(0, 0, 0);">pivot)<br />     j</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">;<br />    </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(i</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">j)<br />     arr[i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> arr[j];<br />    </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(i</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">j </span><span style="color: rgb(0, 0, 0);">&amp;&amp;</span><span style="color: rgb(0, 0, 0);"> arr[i]</span><span style="color: rgb(0, 0, 0);">&lt;=</span><span style="color: rgb(0, 0, 0);">pivot)<br />     i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">;<br />    </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(i</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">j)<br />     arr[j</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> arr[i];<br />   }</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">endwhile</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">   arr[i] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> pivot;<br />   </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> end function</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">   </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> pivotpos </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> i; </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">Partition(arr，low，high);</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">   QuickSort(arr, low, pivotpos</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">);<br />   QuickSort(arr, pivotpos</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">, high);<br />  } </span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"><br />   </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">;<br />   </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> arr;<br /> }<br /><br />直接选择排序基本思想<br />  　n个记录的文件的直接选择排序可经过n</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1趟直接选择排序得到有序结果：<br /> ①初始状态：无序区为R[</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">..n]，有序区为空。<br /> ②第1趟排序<br />    在无序区R[</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">..n]中选出关键字最小的记录R[k]，将它与无序区的第1个记录R[</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">]交换，使R[</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">..</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">]和R[</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">..n]分别变为记录个数增加1个的新有序区和记录个数减少1个的新无序区。<br />　　……<br /> ③第i趟排序<br />　　第i趟排序开始时，当前有序区和无序区分别为R[</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">..i</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">]和R[i..n](</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">≤i≤n</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">)。该趟排序从当前无序区中选出关键字最小的记录R [k]，将它与无序区的第1个记录R[i]交换，使R[</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">..i]和R[i</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">..n]分别变为记录个数增加1个的新有序区和记录个数减少1个的新无序区。<br />    这样，n个记录的文件的直接选择排序可经过n</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1趟直接选择排序得到有序结果。<br /><br />    算法描述<br /> </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> SelectSort(arr) { </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">选择排序-&gt;直接选择排序</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> st </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Date();<br />  </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> temp;<br />  </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> i</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; i</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">arr.length; i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br />   </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> k </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> i;<br />   </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> j</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">i</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">; j</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">arr.length; j</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br />    </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">((arr[j]) </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> (arr[k]))<br />     k </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> j;<br />   }<br />   </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (k </span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);"> i){<br />    temp </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> arr[i];<br />    arr[i] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> arr[k];<br />    arr[k] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> temp;<br />   }<br />  }<br />  status </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Date() </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> st) </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> ' ms';<br />  </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> arr;<br /> }<br /></span></div></span></p>
<img src ="http://www.blogjava.net/juhongtao/aggbug/131899.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/juhongtao/" target="_blank">javaGrowing</a> 2007-07-23 16:23 <a href="http://www.blogjava.net/juhongtao/archive/2007/07/23/131899.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>