Das Notes Forum
Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: Joe am 20.05.03 - 16:20:05
-
Hi liebe Notes-Gemeinde,
ich habe - mal wieder - ein Problem, das ich nicht lösen kann. In einer Maske habe ich ein Feld, das eine Zahlenliste enthält. Diese Zahlenliste ist willkürlich, ich brauche sie aber aufsteigend sortiert. Diese neue Liste soll entweder den alten Feldinhalt ersetzen oder in ein neues Feld geschrieben werden, das ist mir egal.
Ist mir noch zu helfen???
Joe
-
... suche mal nach quicksort
-
Quicksort ist prime, aber das sortiert meines Wissens nur alphanumerisch. Ich brauche aber eine numerische Sortierung, da es sich um Zahlen handelt ???
-
kommt aufs quicksort an, oder ;) ;)
hinter dem begriff versteckt sich nur ein algorithmus...
das hier hab ich mal gefunden ->
Public Sub QuickSortVariants(vArray As Variant, inLow As Long, inHi As Long)
Dim pivot As Variant
Dim tmpSwap As Variant
Dim tmpLow As Long
Dim tmpHi As Long
tmpLow = inLow
tmpHi = inHi
pivot = vArray((inLow + inHi) \ 2)
While (tmpLow <= tmpHi)
While (vArray(tmpLow) < pivot And tmpLow < inHi)
tmpLow = tmpLow + 1
Wend
While (pivot < vArray(tmpHi) And tmpHi > inLow)
tmpHi = tmpHi - 1
Wend
If (tmpLow <= tmpHi) Then
tmpSwap = vArray(tmpLow)
vArray(tmpLow) = vArray(tmpHi)
vArray(tmpHi) = tmpSwap
tmpLow = tmpLow + 1
tmpHi = tmpHi - 1
End If
Wend
If (inLow < tmpHi) Then QuickSortVariants vArray, inLow, tmpHi
If (tmpLow < inHi) Then QuickSortVariants vArray, tmpLow, inHi
End Sub
gruss
-
Danke! Hat geklappt.