摘要:
object HuffmanCode { private abstract sealed class Tree[A] { val freq: Int def toCode: List[(A, String)] = toCodePrefixed("") def toCodePrefixed(prefix: String): List[(A, String)] ... 阅读全文
posted @ 2019-03-24 17:13
wqkant
阅读(140)
评论(0)
推荐(0)
摘要:
def gray(n: Int): List[String] = { def go(x: Int, result: List[String]): List[String] = { if (x ("0" + s)) ++ result.reverse.map(s => ("1" + s)) go(x - 1, cur) } } ... 阅读全文
posted @ 2019-03-24 16:02
wqkant
阅读(144)
评论(0)
推荐(0)