Question: Problem A) (20 Points) Computing the Probability of Character Occurrence Many string analysis tasks (particularly in genomics and cryptography) involve counting character occurrences. Give a
Problem A) (20 Points) Computing the Probability of Character Occurrence Many string analysis tasks (particularly in genomics and cryptography) involve counting character occurrences. Give a string, we would like to find the probability of occurrence of cach character, relative to the other alphabetic characters in the string. For example, each character in the string "supercalifragilisticexpialidocious" has the following probability of occurrence: a: 8.8%, c: 8.8%, d: 2.98, e: 5.98, f: 2.9%, g: 2.9%, i: 20.68, 1: 8.8%, o: 5.9%, p: 5.9%, r: 5.9%, s: 8.8%, t: 2.98, u:5.9%, x: 2.98. Write a C++ program that accepts a string as input from a user and calculates the probability of occurrence (a percentage) for each alphabetic character in the word. Use an array to store the counts of each character. Below are examp les from three different runs of the program. Enter a string: supercalifragilisticexpialidocious a: c: d: e: 8.8% 8.8% 2.9% 5.9% g: i 1: o: p: r: s: t: u: x: 2.9% 20 . 6% 8.8% 5.9% 5.99 5.9% 8.8% 2.9% 5.9% 2.9% Enter a string: The quick brown fox jumps over the lazy dog a: b: c: 2.3% 2.3% 2.3% 2.3%
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
