Skip to main content
edited tags
Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Tweeted twitter.com/#!/StackMma/status/593803770263375872
Source Link
d125q
  • 437
  • 3
  • 9

How to label only leaves in TreeForm?

I have a Huffman encoding represented as a list in the following manner:

encoding = {{{w, d}, {o, s}}, {{{e, q}, a}, {i, j}}};

This means that w is encoded using $000$, d is encoded using $001$, e is encoded using $1000$, and so on. When I print the list in TreeForm, it looks like this:

Huffman

Which is pretty fine on its own right, however, I would want to label only the leaves and ignore the internal nodes which say List. How should I go about doing this?