Compare commits
No commits in common. "4174b3f7e322f81d41cfe3623430c48cc39aeb76" and "4f2f11bd1a5132f9d4a2893cff5de32b075fb2da" have entirely different histories.
4174b3f7e3
...
4f2f11bd1a
@ -14,14 +14,11 @@ function g_median {
|
|||||||
local g_middle=$((g_num_elements/2))
|
local g_middle=$((g_num_elements/2))
|
||||||
|
|
||||||
local g_median
|
local g_median
|
||||||
# even/odd number
|
# Falls die Anzahl der Elemente ungerade ist
|
||||||
if ((g_num_elements % 2 == 1))
|
if ((g_num_elements % 2 == 1)); then
|
||||||
then
|
|
||||||
# odd number
|
|
||||||
echo "g_middle=$g_middle"
|
|
||||||
g_median=${g_sorted_numbers[g_middle]}
|
g_median=${g_sorted_numbers[g_middle]}
|
||||||
else
|
else
|
||||||
# even number
|
# Falls die Anzahl der Elemente gerade ist
|
||||||
g_calc "(${g_sorted_numbers[g_middle - 1]} + ${g_sorted_numbers[g_middle]}) / 2"
|
g_calc "(${g_sorted_numbers[g_middle - 1]} + ${g_sorted_numbers[g_middle]}) / 2"
|
||||||
g_median=$g_calc_result
|
g_median=$g_calc_result
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user