ezzetabi Posted July 5, 2005 Posted July 5, 2005 Func _MaxMin(ByRef $aArray, ByRef $vMin, ByRef $vMax) Local $c, $iSp If Mod(UBound($aArray), 2) = 0 Then $iSp = 2 If $aArray[0] < $aArray[1] Then $vMin = $aArray[0] $vMax = $aArray[1] Else $vMin = $aArray[1] $vMax = $aArray[0] EndIf Else $iSp = 1 $vMin = $aArray[0] $vMax = $aArray[0] EndIf For $c = $iSp To UBound($aArray) - 1 Step 2 If $aArray[$c] < $aArray[$c + 1] Then If $aArray[$c] < $vMin Then $vMin = $aArray[$c] EndIf If $aArray[$c + 1] > $vMax Then $vMax = $aArray[$c + 1] EndIf Else If $aArray[$c + 1] < $vMin Then $vMin = $aArray[$c + 1] EndIf If $aArray[$c] > $vMax Then $vMax = $aArray[$c] EndIf EndIf Next EndFunc
blindwig Posted July 5, 2005 Posted July 5, 2005 Cool idea! One thinig though - I'd suggest you adjust your comparison routine to match that of the _ArraySort routines, as far the ability to compare INTs to Strings, etc. My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now