BUBBLE 01
Sub BUBBLE01()
For X = 1 To N - 1
For Y = X + 1 To N
If R(X) < R(Y) Then
C = R(X)
R(X) = R(Y)
R(Y) = C
End If
Next Y
Next X
End Sub
BUBBLE 02
Sub BUBBLE02()
For X = 1 To N
For Y = 1 To N - X
If R(Y) > R(Y + 1) Then
C = R(Y)
R(Y) = R(Y + 1)
R(Y + 1) = C
End If
Next Y
Next X
End Sub
BUBBLE03
Sub BUBBLE03()
X = 0
Do
F = 0
X = X + 1
For Y = 1 To N - X
If R(Y) < R(Y + 1) Then
C = R(Y)
R(Y) = R(Y + 1)
R(Y + 1) = C
F = 1
End If
Next Y
Loop Until F = 0
End Sub
Private Sub Option2_Click()
P = 3
End Sub
SHELL SHORT
Sub SHELLSHORT()
G = N \ 2
While G > 0
Do
F = 0
For I = 1 To N - G
If R(I) < R(I + G) Then
C = R(I)
R(I) = R(I + G)
R(I + G) = C
F = 1
End If
Next I
Loop Until F = 0
G = G \ 2
Wend
End Sub
SELECT SORT
Sub SELECTSORT()
For X = 1 To N - 1
S = X
For Y = X + 1 To N
If R(S) > R(Y) Then S = Y
Next Y
If S <> X Then
C = R(S)
R(S) = R(X)
R(X) = C
End If
Next X
End Sub
0 komentar:
Posting Komentar