Open
Description
Way to reproduce:
sage: from sage.coding.source_coding.huffman import Huffman
sage: a = {'120': 1, '167': 1, '17': 1, '75': 1, '98': 2, '99': 1}
sage: b = a.copy()
sage: H1 = Huffman(a)
sage: H2 = Huffman(b)
sage: H1.encoding_table() == H2.encoding_table()
False
Sage version:
sage: version()
'SageMath version 7.5.1, Release Date: 2017-01-15'
I think the problem is with enumerate and items calls inside the _build_code function of Huffman class because there is no a standard order of the elements.
Component: coding theory
Keywords: Huffman
Issue created by migration from https://trac.sagemath.org/ticket/25798