- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
快速排序(国外英语资料)
快速排序(国外英语资料)
Quick sort algorithm directory [hide]
basic thought
Algorithm process
Qsort standard range for Pascal
Qsort in Java
[edit this paragraph] basic idea
An improvement of quick sort to bubble sort. The basic idea is: through a sort to two part sorting data into independent, a part of all of the data are all data than another to be a small part, and then according to the method of the two part of the data were quick sort, the ordering process can be performed recursively, in order to achieve the data into an orderly sequence.
[edit this paragraph] algorithmic process
The array to be sorted is A[0]...... A[N-1], first select an arbitrary data (usually the first choice of data) as the key data, and then all it smaller than the number in front of it, all the larger number of put it all behind, this process is called a lie quick sort. Lie fast sorting algorithm is:
1) set two variables, I, J, when the sort begins: I=1, J=N;
2) assign the value of the first array element as the key data to X, that is, X=A[1];
3) start a search from the J, that is, start the forward search (J=J-1) and find the first value less than X, so that the value is exchanged with the X;
4) start a backward search from the I, that is, by starting the backward search (I=I+1), and finding the first value greater than the X to exchange the value with the X;
5) repeat third, fourth steps until I=J;
For example, the values of the array A to be sorted are: (initial key data: X=49)
A[0], A[1], A[2], A[3], A[4], A[5], A[6]:
49386597761327
After the first exchange: 27386597761349
Follow the third steps of the algorithm
After second exchanges: 27384997761365
(in the fourth step of the algorithm, look for the value of X from the front, 6549, and both, at this time: I=3)
After third exchanges: 27381397764965
(in the fifth step of the algorithm, the third step of the algorithm is started again
After fourth exchanges: 27381349769765
(in the fourth step of the algorithm, find the value greater than X from
文档评论(0)