Wyo VB Lecture Notes
Objective #1: Trace and apply the sequential search algorithm.
Objective #2: Trace and apply the binary search algorithm.
System.Array.Sort(mintScores)
While (Not (blnFound) And intLow <= intHigh)
If (mintScores(intMid) = intKey) Then
blnFound = True
Else
If (mintScores(intMid) > intKey) Then
intHigh = intMid - 1
ElseIf (intKey > mintScores(intMid)) Then
intLow = intMid + 1
End If
intMid = Math.Round((intLow + intHigh) / 2)
End If
End While
If (blnFound = True) Then
lblResult.Text = "Found in position " + intMid.ToString()
Else
lblResult.Text = "Not Found"
End If
End Sub