Yeah, recursively storing the tree itself and reading it back is more space efficient in the average case, although the most optimized method of storing character frequencies can beat it for some contrived, worst-case trees. It's definately the more elegant solution, since it take 5 lines of code to write it to the file and another 5 to read it back, with no priority queue needed on the decompress. |