一个国外牛人JavaScript实现的Huffman对代码进行压缩的方法。
采集日期:2008-4-24作者:挨踢老男人(注:本数据由系统自动采集,内容与BHCODE无关)
while (Depth >= 0) { // If there is a left and right, push them on the stack if (NodeChild1[DepthIndex[Depth]] > -1 && NodeChild2[DepthIndex[Depth]] > -1) { idx = NodeChild1[DepthIndex[Depth]];DepthIndex[Depth] = idx;CodeIndex[Depth + 1] = c + ‘0‘; DepthIndex[Depth] = 0 - FinalNodes[idx]; CodeIndex[Depth] = c + ‘1‘; Depth ++; } else { LetterCodes[FinalNodes[DepthIndex[Depth]]] = CodeIndex[Depth]; Depth --;