Solve the following problem:
Using a text file compute the probabilities of each letter pi.
(a) Assume that we need a codeword of length [log2 1/Pi] to encode the letter i. Determine the number of bits needed to encode the file.
(b) Compute the conditional probabilities P{i/j) of a letter / given that the previous letter is j . Assume that we need to represent a letter / that follows a letter y. Determine the number of bits needed [log2 1/P(i/j)] to encode the file.