Check sort/Visual Basic

== Performance Analysis ==
== Visual Basic code ==
(You will need to add a Command Button to the form to print out the list of sorted numbers.)
#Option Explicit
#'------ Check sort & Rapid sort -----
#'Please use the following criteris to write Visual Basic
#'programs for any of the sort routines you feel capable of
#'eliminating duplicates in a list in addition to sorting the list:
#'1.) Total number of items sorted.
#'2.) Total primary array size to accommodate the sort.
#'3.) Total secondary array size to accommodate the sort.
#'4.) Total length of key.
#'5.) Total time for setupTime for setup refers to the time required to index the array variables with input data and increment the indexed variable's contents..
#'6.) Total time for sort Time for sort refers to the time required to parse the array, i.e., sequentially list or print indexes of variables with non-zero values..
#'--------------------------------------------------
#Dim a() As Long, b() As Long
#Dim i As Long, n As Long, j As Long, k As Long
#Dim start As Double, finish2 As Double, finish1 As Double
#Const one As Integer = 1
#Const zero As Integer = 0
#Const maxi As Long = 9999999
#Const topnum As Long = 9999999
#Const botnum As Long = one
#Private Sub Form_Load()
#'--- clear file --------------------
#Open "c:\checksort.txt" For Output As 1
#Print #1, ""
#Close 1
#'--------------------------------------
#For k = botnum To topnum Step topnum / 100
#start = Timer
#'--------- load the array ------------
#'ReDim a(maxi), b(maxi)
#ReDim a(k), b(k)
#For i = botnum To k
#n = Int(k * Rnd) + botnum
#'a(n) = a(n) + one '(Used in place of a(n) = one below to convert Check sort to Rapid sort)
#a(n) = one '(Check sort)
#Next
#'--------end setup start sort ------------------
#finish1 = Timer - start
#start = Timer
#j = 0
#'------------------------------------------------------------
#For n = botnum To k
#If a(n) > zero Then b(j) = n: j = j + one
#Next
#'------------------------------------------------------------
#finish2 = Timer - start
#'-------------------------------------------------
#Open "c:\checksort.txt" For Append As 1
#Print #1, k; Chr$(9); finish1; Chr$(9); finish2
#Close 1
#'------------------------------------------------------------
#DoEvents
#Next k
#'------------------------------------------------------------
#Debug.Print
#Debug.Print "RESULTS: (Check sort)"
#Debug.Print
#Debug.Print "1.) Total number of items sorted:...................... "; Format(j, " #,###,###,###")
#Debug.Print "2.) Total primary array size to accomodate the sort:... "; Format(maxi, " #,###,###,###")
#Debug.Print "3.) Total secondary array size to accomodate the sort:. "; Format(j, " #,###,###,###")
#Debug.Print "4.) Total length of key:............................... "; Len(Str$(k)) - one; " decimal digits."
#Debug.Print "5.) Total time for setup:.............................. "; finish1; " seconds."
#Debug.Print "6.) Total time for sort:............................... "; finish2; " seconds."
#Debug.Print "7.) Ratio of Total sort time to setup time............. "; finish2/finish1; " percent."
#Debug.Print
#Debug.Print
#Form1.Show
#End
#End Sub
#Private Sub Command1_Click() '(requires command button)
#For i = one To j
#Debug.Print i; b(i)
#Next
#End Sub
----
==note==