Need help recoding a function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all

I have this function that i want to edit. At present this function takes an arraylist and retrieves the index of the smallest interger contained in the arraylist
What i want to do is modify this so that it retrieves the top 10 indexes of the smallest to largest intergers in a arraylist

i.e if arraylist1 contains (2, 4, 1, 3, 1, 5, 1, 0
i want the function to return the indexes in order of the smallest to the largest. In this case it would be: 7, 2, 4, 6, 0, 3, 1,

Public Function GetIndexOfSmallestNumber(ByVal a As ArrayList) As Int3
Dim nSmallestValue As Int3
Dim nSmallestIndex As Int3

nSmallestValue = a.Item(0
nSmallestIndex =
For i = 1 To a.Count -
If a.Item(i) < nSmallestValue The
nSmallestIndex =
nSmallestValue = a.Item(i
End I
Next
Return nSmallestInde
End Functio

Can anyone offer any assistance?
 
Back
Top