急!!急!!急!!求高中VB代码 在线等!!!

来源:百度知道 编辑:UC知道 时间:2024/05/29 15:04:46
选择排序,冒泡排序,顺序查找,对分查找,算术平方根(要求用除均法)今天急用。。

大家帮忙啊
算入期末总评成绩的
5555555555
万分感激

就是用dim。。。。
for语句或者do while 语句
不要狠复杂的语句

选择排序:
Sub Selectionsort (List() As Long, min As Integer, _
max As Integer)
Dim i As Integer
Dim j As Integer
Dim best_value As Long
Dim best_j As Integer

For i = min To max - 1
best_value = List(i)
best_j = i
For j = i + 1 To max
If List(j) < best_value Then
best_value = List(j)
best_j = j
End If
Next j
List(best_j) = List(i)
List(i) = best_value
Next i
End Sub
冒泡排序
' min and max are the minimum and maximum indexes
' of the items that might still be out of order.
Sub BubbleSort (List() As Long, ByVal min As Integer, _
ByVal max As Integer)
Dim last_swap As Integer
Dim i As Integer
Dim j As Integer
Dim tmp As Long

' Repeat until we are done.
Do While min < max
' Bu