A mouse took a stroll through the deep dark wood. A fox saw
the mouse and the mouse looked good. “Where are you going
to, little brown mouse? Come and have lunch in my
underground house.”

étape 1 au tableau on compte la fréquence des lettres.
Le moins fréquent est à traiter en premier.

étape 2 au tableau on construit l'arbre de Huffman.

étape 3 : compression.
On note les labels de la racine vers la feuille qui est le code de chaque lettre.

A devient : 0100
(j'écris _ pour l'espace)
_ devient : 111
m devient : 10 101
o devient : 100
u devient : 0 111
s devient : 10 111
e devient : 001
_ devient : 111
t devient : 000 1
o devient : 100
o devient : 100
k devient : 101 001
_ devient : 111
a devient : ????
_ devient : 111

%:-+-+-+- Engendré par : http://math.et.info.free.fr/TikZ/Arbre/
\begin{center}
% Racine à Gauche, développement vers la droite
\begin{tikzpicture}[xscale=1,yscale=1]
% Styles (MODIFIABLES)
\tikzstyle{fleche}=[->,>=latex,thick]
\tikzstyle{noeud}=[fill=yellow,circle,draw]
\tikzstyle{feuille}=[fill=yellow,circle,draw]
\tikzstyle{etiquette}=[midway,fill=white,draw]
% Dimensions (MODIFIABLES)
\def\DistanceInterNiveaux{3}
\def\DistanceInterFeuilles{2}
% Dimensions calculées (NON MODIFIABLES)
\def\NiveauA{(0)*\DistanceInterNiveaux}
\def\NiveauB{(1.875)*\DistanceInterNiveaux}
\def\NiveauC{(3.625)*\DistanceInterNiveaux}
\def\NiveauD{(5.25)*\DistanceInterNiveaux}
\def\NiveauE{(6.75)*\DistanceInterNiveaux}
\def\NiveauF{(8.125)*\DistanceInterNiveaux}
\def\NiveauG{(9.375)*\DistanceInterNiveaux}
\def\NiveauH{(10.5)*\DistanceInterNiveaux}
\def\NiveauI{(11.5)*\DistanceInterNiveaux}
\def\InterFeuilles{(-1)*\DistanceInterFeuilles}
% Noeuds (MODIFIABLES : Styles et Coefficients d'InterFeuilles)
\node[noeud] (R) at ({\NiveauA},{(13.5)*\InterFeuilles}) {$Tous$};
\node[noeud] (Ra) at ({\NiveauB},{(3.5)*\InterFeuilles}) {$$};
\node[noeud] (Raa) at ({\NiveauC},{(1)*\InterFeuilles}) {$$};
\node[noeud] (Raaa) at ({\NiveauD},{(0.5)*\InterFeuilles}) {$$};
\node[feuille] (Raaaa) at ({\NiveauE},{(0)*\InterFeuilles}) {$H$};
\node[feuille] (Raaab) at ({\NiveauE},{(1)*\InterFeuilles}) {$T$};
\node[feuille] (Raab) at ({\NiveauD},{(2)*\InterFeuilles}) {$E$};
\node[noeud] (Rab) at ({\NiveauC},{(5)*\InterFeuilles}) {$$};
\node[noeud] (Raba) at ({\NiveauD},{(4)*\InterFeuilles}) {$$};
\node[feuille] (Rabaa) at ({\NiveauE},{(3)*\InterFeuilles}) {$A$};
\node[noeud] (Rabab) at ({\NiveauE},{(4.5)*\InterFeuilles}) {$$};
\node[feuille] (Rababa) at ({\NiveauF},{(4)*\InterFeuilles}) {$W$};
\node[feuille] (Rababb) at ({\NiveauF},{(5)*\InterFeuilles}) {$G$};
\node[noeud] (Rabb) at ({\NiveauD},{(6.5)*\InterFeuilles}) {$$};
\node[feuille] (Rabba) at ({\NiveauE},{(6)*\InterFeuilles}) {$D$};
\node[feuille] (Rabbb) at ({\NiveauE},{(7)*\InterFeuilles}) {$U$};
\node[noeud] (Rb) at ({\NiveauB},{(17.5)*\InterFeuilles}) {$$};
\node[noeud] (Rba) at ({\NiveauC},{(10.5)*\InterFeuilles}) {$$};
\node[feuille] (Rbaa) at ({\NiveauD},{(8)*\InterFeuilles}) {$O$};
\node[noeud] (Rbab) at ({\NiveauD},{(11)*\InterFeuilles}) {$$};
\node[noeud] (Rbaba) at ({\NiveauE},{(10)*\InterFeuilles}) {$$};
\node[noeud] (Rbabaa) at ({\NiveauF},{(9.5)*\InterFeuilles}) {$$};
\node[feuille] (Rbabaaa) at ({\NiveauG},{(9)*\InterFeuilles}) {$.$};
\node[feuille] (Rbabaab) at ({\NiveauG},{(10)*\InterFeuilles}) {$K$};
\node[feuille] (Rbabab) at ({\NiveauF},{(11)*\InterFeuilles}) {$M$};
\node[noeud] (Rbabb) at ({\NiveauE},{(12.5)*\InterFeuilles}) {$$};
\node[feuille] (Rbabba) at ({\NiveauF},{(12)*\InterFeuilles}) {$L$};
\node[feuille] (Rbabbb) at ({\NiveauF},{(13)*\InterFeuilles}) {$S$};
\node[noeud] (Rbb) at ({\NiveauC},{(20.5)*\InterFeuilles}) {$$};
\node[noeud] (Rbba) at ({\NiveauD},{(20)*\InterFeuilles}) {$$};
\node[noeud] (Rbbaa) at ({\NiveauE},{(16.5)*\InterFeuilles}) {$$};
\node[noeud] (Rbbaaa) at ({\NiveauF},{(16)*\InterFeuilles}) {$$};
\node[noeud] (Rbbaaaa) at ({\NiveauG},{(14.5)*\InterFeuilles}) {$$};
\node[feuille] (Rbbaaaaa) at ({\NiveauH},{(14)*\InterFeuilles}) {$Y$};
\node[feuille] (Rbbaaaab) at ({\NiveauH},{(15)*\InterFeuilles}) {$"$};
\node[noeud] (Rbbaaab) at ({\NiveauG},{(17)*\InterFeuilles}) {$Nœud36$};
\node[noeud] (Rbbaaaba) at ({\NiveauH},{(16.5)*\InterFeuilles}) {$$};
\node[feuille] (Rbbaaabaa) at ({\NiveauI},{(16)*\InterFeuilles}) {$F$};
\node[feuille] (Rbbaaabab) at ({\NiveauI},{(17)*\InterFeuilles}) {$X$};
\node[feuille] (Rbbaaabb) at ({\NiveauH},{(18)*\InterFeuilles}) {$B$};
\node[feuille] (Rbbaab) at ({\NiveauF},{(19)*\InterFeuilles}) {$N$};
\node[noeud] (Rbbab) at ({\NiveauE},{(23)*\InterFeuilles}) {$$};
\node[feuille] (Rbbaba) at ({\NiveauF},{(20)*\InterFeuilles}) {$R$};
\node[noeud] (Rbbabb) at ({\NiveauF},{(23.5)*\InterFeuilles}) {$$};
\node[noeud] (Rbbabba) at ({\NiveauG},{(22.5)*\InterFeuilles}) {$$};
\node[noeud] (Rbbabbaa) at ({\NiveauH},{(21.5)*\InterFeuilles}) {$$};
\node[feuille] (Rbbabbaaa) at ({\NiveauI},{(21)*\InterFeuilles}) {$P$};
\node[feuille] (Rbbabbaab) at ({\NiveauI},{(22)*\InterFeuilles}) {$V$};
\node[noeud] (Rbbabbab) at ({\NiveauH},{(23.5)*\InterFeuilles}) {$$};
\node[feuille] (Rbbabbaba) at ({\NiveauI},{(23)*\InterFeuilles}) {$?$};
\node[feuille] (Rbbabbabb) at ({\NiveauI},{(24)*\InterFeuilles}) {$,$};
\node[noeud] (Rbbabbb) at ({\NiveauG},{(25.5)*\InterFeuilles}) {$$};
\node[feuille] (Rbbabbba) at ({\NiveauH},{(25)*\InterFeuilles}) {$C$};
\node[feuille] (Rbbabbbb) at ({\NiveauH},{(26)*\InterFeuilles}) {$I$};
\node[feuille] (Rbbb) at ({\NiveauD},{(27)*\InterFeuilles}) {$espace$};
% Arcs (MODIFIABLES : Styles)
\draw[fleche] (R)--(Ra) node[etiquette] {$0$};
\draw[fleche] (Ra)--(Raa) node[etiquette] {$0$};
\draw[fleche] (Raa)--(Raaa) node[etiquette] {$0$};
\draw[fleche] (Raaa)--(Raaaa) node[etiquette] {$0$};
\draw[fleche] (Raaa)--(Raaab) node[etiquette] {$1$};
\draw[fleche] (Raa)--(Raab) node[etiquette] {$1$};
\draw[fleche] (Ra)--(Rab) node[etiquette] {$1$};
\draw[fleche] (Rab)--(Raba) node[etiquette] {$0$};
\draw[fleche] (Raba)--(Rabaa) node[etiquette] {$0$};
\draw[fleche] (Raba)--(Rabab) node[etiquette] {$1$};
\draw[fleche] (Rabab)--(Rababa) node[etiquette] {$0$};
\draw[fleche] (Rabab)--(Rababb) node[etiquette] {$A$};
\draw[fleche] (Rab)--(Rabb) node[etiquette] {$1$};
\draw[fleche] (Rabb)--(Rabba) node[etiquette] {$0$};
\draw[fleche] (Rabb)--(Rabbb) node[etiquette] {$1$};
\draw[fleche] (R)--(Rb) node[etiquette] {$1$};
\draw[fleche] (Rb)--(Rba) node[etiquette] {$0$};
\draw[fleche] (Rba)--(Rbaa) node[etiquette] {$0$};
\draw[fleche] (Rba)--(Rbab) node[etiquette] {$1$};
\draw[fleche] (Rbab)--(Rbaba) node[etiquette] {$0$};
\draw[fleche] (Rbaba)--(Rbabaa) node[etiquette] {$0$};
\draw[fleche] (Rbabaa)--(Rbabaaa) node[etiquette] {$0$};
\draw[fleche] (Rbabaa)--(Rbabaab) node[etiquette] {$1$};
\draw[fleche] (Rbaba)--(Rbabab) node[etiquette] {$1$};
\draw[fleche] (Rbab)--(Rbabb) node[etiquette] {$1$};
\draw[fleche] (Rbabb)--(Rbabba) node[etiquette] {$0$};
\draw[fleche] (Rbabb)--(Rbabbb) node[etiquette] {$1$};
\draw[fleche] (Rb)--(Rbb) node[etiquette] {$1$};
\draw[fleche] (Rbb)--(Rbba) node[etiquette] {$0$};
\draw[fleche] (Rbba)--(Rbbaa) node[etiquette] {$0$};
\draw[fleche] (Rbbaa)--(Rbbaaa) node[etiquette] {$0$};
\draw[fleche] (Rbbaaa)--(Rbbaaaa) node[etiquette] {$0$};
\draw[fleche] (Rbbaaaa)--(Rbbaaaaa) node[etiquette] {$0$};
\draw[fleche] (Rbbaaaa)--(Rbbaaaab) node[etiquette] {$1$};
\draw[fleche] (Rbbaaa)--(Rbbaaab) node[etiquette] {$1$};
\draw[fleche] (Rbbaaab)--(Rbbaaaba) node[etiquette] {$0$};
\draw[fleche] (Rbbaaaba)--(Rbbaaabaa) node[etiquette] {$0$};
\draw[fleche] (Rbbaaaba)--(Rbbaaabab) node[etiquette] {$1$};
\draw[fleche] (Rbbaaab)--(Rbbaaabb) node[etiquette] {$1$};
\draw[fleche] (Rbbaa)--(Rbbaab) node[etiquette] {$1$};
\draw[fleche] (Rbba)--(Rbbab) node[etiquette] {$1$};
\draw[fleche] (Rbbab)--(Rbbaba) node[etiquette] {$0$};
\draw[fleche] (Rbbab)--(Rbbabb) node[etiquette] {$1$};
\draw[fleche] (Rbbabb)--(Rbbabba) node[etiquette] {$0$};
\draw[fleche] (Rbbabba)--(Rbbabbaa) node[etiquette] {$0$};
\draw[fleche] (Rbbabbaa)--(Rbbabbaaa) node[etiquette] {$0$};
\draw[fleche] (Rbbabbaa)--(Rbbabbaab) node[etiquette] {$1$};
\draw[fleche] (Rbbabba)--(Rbbabbab) node[etiquette] {$1$};
\draw[fleche] (Rbbabbab)--(Rbbabbaba) node[etiquette] {$0$};
\draw[fleche] (Rbbabbab)--(Rbbabbabb) node[etiquette] {$1$};
\draw[fleche] (Rbbabb)--(Rbbabbb) node[etiquette] {$1$};
\draw[fleche] (Rbbabbb)--(Rbbabbba) node[etiquette] {$0$};
\draw[fleche] (Rbbabbb)--(Rbbabbbb) node[etiquette] {$1$};
\draw[fleche] (Rbb)--(Rbbb) node[etiquette] {$1$};
\end{tikzpicture}
\end{center}
%:-+-+-+-+- Fin

