- 1、本文档共18页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
vb中一维二维数组应用(国外英语资料)
vb中一维二维数组应用(国外英语资料)
A one-dimensional array
The sorting
One, selection sort:
The data is already placed in an array of one-dimensional arrays, requiring a small to large order.
An array of
20
4
36
......
45
109
3
The subscript
one
2
3
......
N - 2
N - 1
n
Ordering process:
Select the minimum value from item 1 to n, and then exchange the first item with the minimum.
Select the lowest value from item 2 to n, then exchange the second with the minimum.
3,...
Select the lowest value from n-1 to n, and then exchange the n-1 item with the minimum.
Note: minimum and subscripts are stored by temporary variables.
So, you need two layers of loops: the outer loop I performs n minus 1, and the inner loop j executes n minus I minus 1 times
For I = 1 to n - 1
Minimum and subscripts are stored by temporary variables
TmpVal = the first item I value
The first item I subscript tmpId =
For j = I + 1 to n
If tmpVal the JTH term value, then:
TmpVal section j = value
The first item j subscript tmpId =
next
Change the I term to the minimum term
Next
From big to small?
Bubble sort:
The data is already placed in an array of one-dimensional arrays, requiring a small to large order.
An array of
20
4
36
......
45
109
3
The subscript
one
2
3
......
N - 2
N - 1
n
Two methods: floating and sinking of large Numbers.
The sequence of the floating sequence of decimal places: from the NTH term to the k th term, in order of the two terms, if the m term is less than the m-1 term, then the two terms are exchanged. From 2 to n (k)
The first execution: the result is the smallest value in item 1 to the NTH term in item 1
If the NTH term is less than the n-1 term, the NTH term is swapped with the n-1 term.
2, if the n-1 term is less than the n-2 term, the n-1 term is swapped with the n-2 term.
3,...
If the second term is less than the first term, the second term will be exchanged with the first item.
Second execution: the result is the lowest value in the second term to the NTH term in the second term
If th
文档评论(0)