Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use c++ for the last question. 1.Let X be a random variable that takes on integer values. The probability is that X will be in

Use c++ for the last question.

1.Let X be a random variable that takes on integer values. The probability is that X will be in the range [0,24-1] with all values in that range being equally likely. The rest of the time, it will be in the range [24,28-1], again with uniform probability. What is the entropy H(X)? (Estimation is OK).

2. A bag contains 7 red balls, 2 green balls, and 1 black ball. a. You choose 2 balls from the bag with replacement (i.e. you put the first ball back in and shake before drawing the second). What is the entropy of the experiment? b. You choose 2 balls from the bag without replacement (i.e. you keep the first ball while drawing the second). How is your uncertainty affected now that you know the color of the first ball before drawing the second? What is the entropy of this new experiment given the first ball you choose is red?

3. Write a small program that loads in a text file of any size and then prints the frequency (as a percentage) of each character (a..z). All characters should be made lowercase for counting purposes. Ignore punctuation, spaces, etc. Output should be sorted in decreasing frequency order (e, t, a, o, etc.) and look something like: e 13.27% t 9.11% a 8.47% o 7.32% q 0.01% z 0.00%

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions