I was looking for an efficient algorithm to generate all unique permutations of sequences with repeated values (in Python). One of the questions/answers I came across was this question. With an appropriate title of: "permutations with unique values," it's easily found when searching. The accepted answer is perfectly acceptable: I wouldn't want to disparage it.
I had however, already come across this answer to a question, who's title, "Can this algorithm be improved without recursion," wouldn't garner near as much attention. The accepted answer is a nice python implementation of Knuth's "Algorithm L", and runs in about 1/4 of the time as the accepted, popular answer on the other question.
As we all know, one could rewrite this in C/assembler and make it faster if speed was really important, but given that Stack Overflow is, or at least wants to be, the go-to place for the best answers to questions, I was curious what the best way of drawing attention to this alternate answer was.
Some options:
- Do nothing. A casual Stack Overflow search will find the slower algorithm, but too bad.
- Leave a comment on the popular question (and/or the accepted answer) that an alternative solution existed elsewhere and was faster (not sure how many users seeking answers bother to read all the comments).
- Change the title of the unpopular question to something better reflecting the actual topic it's asking about (even if the asker didn't realize exactly what they were asking for). This may help partially, but the other question's popularity lead will probably still get it all the hits.
- Leave a comment on the less popular answer that he should cross-post his great answer on the other question (I'm not even sure if this behaviour is frowned upon).
Recommendations on the best action to take (if any)?
Edit:: 5) Migrate the (slightly better) answer to the popular question (was suggested in a comment by @Theolodis...can this be done?)