learning Haffman Algorithm