So what does your code return for encode("")? According to the error message you posted, it returns an index out of range error. Fix that.
I know I'm 2 years late, but I saw your comment and noticed you still don't have a solution.
I found it helps to understand the algorithm if you do some examples by hand.
If you encode "Mellow Yellow" and "Melllow Yelow" by hand, you should see a difference.
Very nice kata. Been using these things for a while and it was a lot of fun / very insightful to see how they're made :)
My return is two elements. I am still getting this error. Can you point me in the right direction?
Even the test is showing one return element
OP solved it, closing
added some time ago
No more help needed, I found the origin.
I am testing Huffman encoding in Python: Passed tests : 2781 but Failed tests: 265
I don't undestand the following error
ERROR restore sorted sequence from frequencies should succeed:  should equal ['l']
Can you help me Please
test.assert_equals( encode( fs, ), '')
test.assert_equals( encode( , "" ), None );
test.assert_equals( encode( [('a', 1)], "" ), None );
test.assert_equals( encode( [ ("a",4), ("b",1), ("c",2) ], "" ), "" )
takes: [ (str, int) ], str; returns: String (with "0" and "1")
Other people have mentioned the empty string. I was pulling my hair out trying to optimize my code until I realized the timeout I was getting was because I was't handling it. Perhaps handing this as input could be clearer? Maybe that is just my lack of experience.
there is no such thing as an empty array in C, it's forbidden by the standard
Currently working my way through this (C#) and noticed a few things that irk me:
encode? easy :)
decode? 0_0, how I get banana back?
I was getting "SEGV on unknown address" many many times...
until I figured out that input in decode() can be empty string.
hope my experience will help someone in future.
very interesting kata. I should google more about BWT logic, to implement decode()
however it was cool and exiting. thanks for kata.
Exactly, some expected outcomes would be good!