to a probability vector p = (P₁, P2,..., Pn) usin inction freq_to_prob (c) that takes a frequen bility vector p.

Question

Write in Java 

Given a vector of frequencies c = (C₁, C2, ..., Cn), where n ≥ 1 and all c; are non-negative integers. We can
convert this vector into a probability vector p = (P₁, P2, ..., Pn) using the formulation: p₁ = Ci/(Σi_1 Ci),
for all i. Write a function freq_to_prob (c) that takes a frequency vector c as input and returns the
corresponding probability vector p.
Transcribed Image Text:Given a vector of frequencies c = (C₁, C2, ..., Cn), where n ≥ 1 and all c; are non-negative integers. We can convert this vector into a probability vector p = (P₁, P2, ..., Pn) using the formulation: p₁ = Ci/(Σi_1 Ci), for all i. Write a function freq_to_prob (c) that takes a frequency vector c as input and returns the corresponding probability vector p.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer