Hi,
I think it can be done in Bash (bah, I know because I just did it jajaja). So here I present a solution:
Code:
function moreFrequent {
nums=$*
# Builds an array using your numbers as an index
# and the frequency as its value.
# In Bash it doesnt matter if the index are not contiguos
for NUM in ${nums[@]}; do
freq[$NUM]=`expr ${freq[$NUM]} + 1 `;
done
# The for writes a list with the number and its frequency
# Then it is sorted by the frequency (with the sort command),
# is filtered the first line online (with the head command),
# and finaly just cuts the frequency part (with the cut command).
for NUM in echo ${nums[@]}; do
echo "$NUM ${freq[$NUM]}"
done | sort -n -k 2 -r | head -n 1 | cut -d ' ' -f 1
}
numbers=(1 3 3 4 3 6 3 6 4 4)
yourCoolNumber=`moreFrequent ${numbers[@]}`
echo "The more frequent numbers is $yourCoolNumber"
Perhaps this is not the best solution, but it's a cool function which may be useful for you.
Hope it is!
Greetings.