Skip to content

Conversation

@Liikt
Copy link

@Liikt Liikt commented Oct 1, 2018

compiled with go version go1.11 linux/amd64 and without errors

@leios leios added the Hacktoberfest The label for all Hacktoberfest related things! label Oct 1, 2018
@june128 june128 added the Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) label Oct 1, 2018
@leios leios mentioned this pull request Oct 2, 2018
}

for len(nodeList) > 1 {
sort.Slice(nodeList, func(i, j int) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This basically destroys the algorithmic complexity of Huffman-encoding. We could either use container/heap or roll our own version of it (a heap is pretty easy to implement and it could avoid having to cast back from interface).

}

// 0x30 == "0" and 0x31 == "1"
code = append(code, 0x30)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just use '0' and '1'?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i forgot that '1' is a rune/byte

@zsparal zsparal merged commit 20576b6 into algorithm-archivists:master Oct 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Hacktoberfest The label for all Hacktoberfest related things! Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.)

4 participants