Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getCharCode(tree: HuffmanCodingTree, code: List[Int]): (Char, List[Int]) = (tree, code) match {
- case (tr, x :: xs) if tr.chars.length == 1 => (tr.chars.head, xs)
- case (tr, x :: xs) if x == 0 => getCharCode(tr.asInstanceOf[HuffmanCodingTreeNonLeaf].leftChild, xs)
- case (tr, x :: xs) if x == 1 => getCharCode(tr.asInstanceOf[HuffmanCodingTreeNonLeaf].leftChild, xs)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement