Tl;dr: I think my question on Huffman coding was wrongly closed as duplicate and should be re-opened.

Early this week, I had the idea of posting a challenge based on Huffman coding. I found a very old question that was based on Huffman coding at the core, but the execution was different: Huffman golfing. My idea of what the output should be was different, so I asked about it in chat:

Okay, so, there's a really old question on Huffman encoding, which asks for a Huffman tree. What I had in mind was that programs would compute the Huffman coding and then output each character along with its binary representation, sorted from shortest/most frequent to longest/least frequent. Are these different enough that they wouldn't be duplicates?

Only one person responded, Thomas Kwa, who said:

It would not be a duplicate, because you can't trivially modify answers to that question to answer your new question.

So I sandboxed it. The only response was a recommendation from feersum to add a time limit, which I did when I posted it, about 27 hours later.

Then, much to my irritation, Peter Taylor closed it as duplicate with this comment:

I disagree with your note: it's the same question which for the existing answers requires a simple transformation of output format, and moreover any answer to this question is automatically an answer to the previous question.

(The note being that the Huffman golfing question was not a duplicate because you can't trivially modify the existing answers to fit the new question.)

I vocally disagreed with this in chat starting here. I'll summarize what I think are the strongest points:

  • There are no CJam or Pyth answers on the old question. (They were created well after it.)
  • It is better written because it gives an example for demonstration and has several test cases.
  • The spec is better, which Martin said in chat.

His comment that perhaps the old question could be closed as a duplicate of the newer one lead me to research this on this Meta. I found four Meta questions that seemed to be relevant.

The first doesn't have a particularly clear community consensus, but the (at-the-moment) positive score answer has this:

  1. There may be users that would like to answer the new question that would not have wanted to answer the old question (because of the differences)
  2. There may be users that would like to answer the new question that missed the old question. i.e. perhaps they only joined the site within the last month, or were just not online often enough before the question got knocked off the "active/recent questions" list. Are these users expected to go and search for old/inactive questions to answer?

On the second, I'd like to say that I agree with xnor's answer. In particular:

But if the new question is much better than the old one, closing it is a needless loss in quality for the site. I'd like for the duplicate policy to be more flexible, and allow a repeat of a question if the new one is significantly better than the old.
Is this really serving the community interest? It's sad when someone posts a well thought-out, exactly-specified, test-cased question, and it's closed because the same challenge was posed in a question from 2011 with an ambiguous two-sentence spec and only a few mediocre answers.

I seriously believe that's the situation with the Huffman coding questions. Anyway, Martin's answer on the third sets forth a criteria that's repeated as community consensus on the fourth:

Can answers from one question be copied over to the other with little or no modification and still be competitive?

I honestly believe that the answer is no for the two Huffman coding questions. Only two of five users who posted on the old question have been around this year, and one of those two hasn't been seen for months. This particular challenge idea would really benefit from being re-posted these days and I think it's not a good idea to simply edit the old one. (For one, I spent an hour writing that "Code the Huffman!" question and the original poster of the old one shouldn't get the reputation for it.)

So yeah, that's my case for reopening the "Code the Huffman!" question.


3 Answers 3


TL;DR: They are duplicates. Close the old one.

First, I'd like to clarify that I do think the questions are duplicates. I agree with Peter that a difference in the output format counts as a "minor modification" to existing answers, unless the output formatting is the core of the challenge (which arguably it isn't in this case). So the criterion you're quoting me with ("Can answers from one question be copied over to the other with little or no modification and still be competitive?"), I would answer with "yes".

To address some of your other arguments

There are no CJam or Pyth answers on the old question. (They were created well after it.)

I don't think that should be a valid reason for reposting a challenge. New languages are created all the time, which would basically mean we can repost any challenge any time because "this new language or version couldn't be used on the old challenge". I agree that our rules for using newer challenges are sometimes counter productive because they aim to close a very specific loophole (someone creating a language or adding features to solve a specific challenge with a built-in), but more often than not they prevent legitimate languages from participating. This is why I would like to see the spirit of this community to go more towards "each challenge is a competition within each language", because then it doesn't matter if the problem is particularly trivial (read: boring) in one special-purpose language. Anyway, I digress...

Are these users expected to go and search for old/inactive questions to answer?

Yep. That's why we archive our challenges and most challenges don't have deadlines. Especially when someone posts a new similar or identical challenge, the old one will surely be linked by more experienced users and can then more easily be found. (Honestly, I disagree with the entire answer this was quoted from.)

Only two of five users who posted on the old question have been around this year, and one of those two hasn't been seen for months.

I don't think this is a valid argument either. For one thing, anyone else could copy their answers, for another this still leaves the issue of answers to the new challenge being copied over to the old one.

One more from a comment of yours on the question:

Finally, the other question is four years old. It'd be good to have a fresh version.

Not an argument either if there is nothing wrong with the old challenge.

So in summary, yes, I think they are duplicates.


As I said in chat:

Maybe this would be a good time to close an old question as a duplicate?

Like the first question linked in the OP shows, I find it odd that we have no culture of closing old questions as duplicates of new ones (and unfortunately, I picked a specific case in the other question where things weren't so clear cut as here). It's reasonably common practice on any other SE. If the new question is better, close the old one. The same should go for PPCG.

Your new question is indeed much better. It has a more solid spec (which is up to today's standards), it has test cases, it's better explained and motivated. So why don't we close the old one as a duplicate of yours?

On my older meta question, Peter raised the issue of what would happen to the old answers. In this case, with only 5 answers, I don't think this is an issue, but even in general, I'd rather see people copying the answers over to the new challenge if that means we can in the future have a better challenge for this particular topic.

Another issue this might raise is that people would just start rehashing loads of old questions, claiming they have some minor flaw here or there and redoing the challenge. So I would propose some guidelines:

  1. If the new challenge was posted in good faith (not knowing that a duplicate already exists), read both challenges in detail and vote to close the worse of the two. We're not improving our content quality by blindly shooting down the new one. One unfortunate example here, was a recent sandbox proposal by a new user (needs privileges to see deleted posts), which was much better than the existing challenge, but was abandoned because it would likely have been closed as a duplicate.
  2. If the differences between the challenges (in terms of quality) are minor, close the new one, in the interest of keeping all the existing answers in their place. More likely than not such minor flaws can be addressed by an edit to the old challenge.
  3. If there are serious issues with the old challenge, close it anyway. We need a way to deliberately supersede old challenges that are not up to today's standards. My favourite example for this is our cat challenge which under our current policies prevents us from having a "good" cat challenge, because this one exists but its flaws don't warrant closing it. I am currently sandboxing a new version to replace this, but so far we don't have any notable precedent of this happening.
  • \$\begingroup\$ Thank you for pointing out the flaws in my arguments. \$\endgroup\$ Oct 29, 2015 at 19:31
  • \$\begingroup\$ What should we do with old answers that do not meet the rules of the new question? Or, say, code snippets? \$\endgroup\$
    – xnor
    Oct 30, 2015 at 1:47
  • 1
    \$\begingroup\$ @xnor Leave them on the old/closed question, of course. And/or adjust them to be valid for the new challenge. \$\endgroup\$ Oct 30, 2015 at 12:42
  • \$\begingroup\$ @MartinBüttner Would it be OK then to modify their code and byte count? Can I use my golfing judgment for the best way to do this? \$\endgroup\$
    – xnor
    Oct 30, 2015 at 20:53
  • 1
    \$\begingroup\$ @xnor Well, ideally you'd leave them a comment to suggest they copy the answer over themselves (along with any golfing suggestions you have). If they don't reply, feel free to repost it yourself with proper attribution. Whether you then make it CW or not depends on how different the final result actually is, so use your best judgement for that. \$\endgroup\$ Oct 30, 2015 at 20:56

No, it should be reopened

I have 3 main criteria that I use to decide if a question is a dupe (partially inspired by Martin's answer on the topic):

  1. Are old answers valid in the new question, or can they be trivially transformed into answers for new questions? The definition of a trivial transformation is a bit subjective, though. If the old answer's output format can be easily modified to fit the new question, it's a trivial transformation. If the old answer's approach is still valid in the new question, it's probably a trivial transformation. Almost always it's a judgement call, since it's not easy to define a cut-and-dry criteria.
  2. Are old answers competitive in the new question? This mainly applies to , , and (and probably others that I'm missing), but also somewhat to , since CJam/Pyth answers may not be valid due to the languages being created after the question.
  3. Is the old challenge free of flaws that can be fixed by edits that won't invalidate answers? It's better to fix up the old question to meet our modern standards if possible, but it's not always possible without invalidating old answers. See this meta post for more discussion on this point.

If the answer to all 3 is "yes", then the new challenge is a dupe in my eyes. If not, then it isn't.

By these critera, I do not see your question as a duplicate.

  1. The old answers are not valid in the new question. Whether or not they are trivially transformable is a bit of a difficult call. To me, this is right on the line; it's simple in theory to generate the Huffman codes for the characters from the tree, but transforming the output of one of the old answers to meet the new format would likely involve just as much code as the answers themselves, and a fresh answer would likely do better.
  2. The old answers might be competitive in the new question, but I would expect new answers (especially in CJam/Pyth, which came after the old question) to do significantly better than the old answers.
  3. The old challenge doesn't have any flaws (other than what I consider poor formatting, but that's minor), and so there's no reason to edit it to match your specifications. Such an edit would invalidate every answer on that question, and so would be a very bad move.

I agree with all of Martin's reasoning as to why they are duplicates.

However, I don't think there's a strong case for closing the old question in favour of the new one. That would fragment the answers (unless the people who posted answers on the old question update them for the new output format and copy them across - but you argue that this is unlikely because most of them are no longer active).

Instead, I will repeat a comment I made on one of the posts you cited.

There are four ways to bring attention to an old challenge: chat, bounty, posting your own answer, and posting a dupe.

If you want to revive the topic of Huffman coding, you can post a bounty on the old question for the shortest answer which uses your output format and which doesn't use a language newer than two days ago.

  • 2
    \$\begingroup\$ I don't think this is about bringing attention to an old challenge. This is about redoing the challenge with a better spec when editing the old challenge (in order to improve its spec to the same standards) is not possible without invalidating answers. \$\endgroup\$ Oct 29, 2015 at 15:17
  • 1
    \$\begingroup\$ @MartinBüttner, I disagree. The old question could have been edited to the standards of the new question without invalidating answers: the only thing about the new question which would invalidate answers is the particular tree syntax which it uses. \$\endgroup\$ Oct 31, 2015 at 17:59
  • \$\begingroup\$ @PeterTaylor I really don't have time for this right now, but you've got my blessing to edit the old question. (My opinion in a nutshell: I find it mildly insulting to have my question closed as duplicate when it was posted in good faith; I don't really recognize my question in the new one, for all I know they could both have lived on if made distinct-looking enough; it no one has the time to edit I'd certainly prefer closing for quality issues with link to the new than duplicate) \$\endgroup\$
    – J B
    Nov 3, 2015 at 15:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .