Moffat and Turpin's 1997 paper On The Implementation of Minimum Redundancy Prefix Codes contains all the usual tricks and then some: https://github.com/tpn/pdfs/blob/master/On%20the%20Implement...
[1] https://cbloomrants.blogspot.com/2010/08/08-12-10-lost-huffm...