First Days: Shannon Entropy – Cryptography

Classwork/Assignment:

NOTE: The following assignment doesn’t require to be Object Oriented.
Generating cryptograms. A cryptogram is obtained by scrambling English text by replacing each letter with another letter. Write a program, Crypto1_YI.java to generate a random permutation of the 26 letters and use this to map letters.
NOTE: It is not necessary to be OOD
Give example: Don’t scramble punctuation or whitespace.

// DS
// ABCDEFGHIJKLMNOPQRSTUVWXYZ
// SDTVBJGXWACIYROLUQPENKMHZF

// SM
/**
[m, n, u, h, y, c, b, s, f, a, i, k, x, r, l, z, w, t, q, o, d, e, p, g, v, j]
please give an all lowercase string to scramble (any non lowercase characters will be skipped
happy make your bed day
smzzv xmiy vldt nyh hmv
*/

Entropy.
The Shannon entropy measures the information content of an input string and plays a cornerstone role in information theory and data compression.

Shannon is famous for having founded information theory.
It was proposed by Claude Shannon in 1948, borrowing upon the concept in statistical thermodynamics. Assuming each character i appears with probability p_{i}, the entropy is defined to be H = – sum p_{i} log_{2}p_{i}, where the contribution is 0 if p_{i} = 0.

Compute entropy of DNA sequence

(a) Write a program, Entropy1_YI.java to read in a ASCII text string from standard input, count the number of times each ASCII character occurs, and compute the entropy, assuming each character appears with the given probabilities.

(b) Repeat part (a) but use Unicode.(Optional)

https://www.khanacademy.org/computing/computer-science/informationtheory/moderninfotheory/v/compressioncodes