Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Averages-Median/VBA/averages-median.vba
Normal file
18
Task/Averages-Median/VBA/averages-median.vba
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
Private Function medianq(s As Variant) As Double
|
||||
Dim res As Double, tmp As Integer
|
||||
Dim l As Integer, k As Integer
|
||||
res = 0
|
||||
l = UBound(s): k = WorksheetFunction.Floor_Precise((l + 1) / 2, 1)
|
||||
If l Then
|
||||
res = quick_select(s, k)
|
||||
If l Mod 2 = 0 Then
|
||||
tmp = quick_select(s, k + 1)
|
||||
res = (res + tmp) / 2
|
||||
End If
|
||||
End If
|
||||
medianq = res
|
||||
End Function
|
||||
Public Sub main2()
|
||||
s = [{4, 2, 3, 5, 1, 6}]
|
||||
Debug.Print medianq(s)
|
||||
End Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue