\begin{wrapfigure}{r}{10cm}
\centering
\vspace{-1.5em}
\begin{tikzpicture} 
\draw( 0, 3 ) rectangle +(4, 0.5);
\draw node[align=center] at (1.25,3.25){ A: \color{blue}$p=0.5$ };
\draw node[align=center] at (3.5,3.25){\color{red}\texttt{~~~0} };
\draw( 0, 2 ) rectangle +(4, 0.5);
\draw node[align=center] at (1.25,2.25){ B: \color{blue}$p=0.25$};
\draw node[align=center] at (3.5,2.25){\color{red}\texttt{~~10}};
\draw( 0, 1 ) rectangle +(4, 0.5);
\draw node[align=center] at (1.25,1.25){ C: \color{blue}$p=0.15$};
\draw node[align=center] at (3.5,1.25){\color{red}\texttt{~110}};
\draw( 0, 0 ) rectangle +(4, 0.5);
\draw node[align=center] at (1.25,0.25){ D: \color{blue}$p=0.1$ };
\draw node[align=center] at (3.5,0.25){\color{red}\texttt{~111}};

\draw (4, 0.25) -| +( 1, 0.5 );
\draw (4, 1.25) -| +( 1, -0.5 ) -- +( 2, -0.5);
\draw (4, 2.25) -| +( 2, -1.5 );
\draw (6, 1.5) -- +( 1, 0);
\draw (4, 3.25) -| +( 3, -1.75);
\draw (7, 2.375) -- +( 1, 0); 
 
\draw node[align=center] at (5.5,1){\color{blue}$0.25$ };
\draw node[align=center] at (5.5,0.5){\color{red}\texttt{11} };

\draw node[align=center] at (6.5,1.75){\color{blue}$0.5$ };
\draw node[align=center] at (6.5,1.25){\color{red}\texttt{1} };

\draw node[align=center] at (8.25,2.375){\color{blue}$1$ };
\end{tikzpicture}
\caption{Example of Huffman Coding}
\label{fig:huffmancoding}
\end{wrapfigure}
