Draft

De Bruijn Sequences - Generation (Part 2)

Description
Loading description...
Combinatorics
Performance
View
AllIssuesQuestions1Suggestions2Show Resolved
  • Please sign in or sign up to leave a comment.
  • JohanWiltink Avatar

    Haskell translation

    Please note I have updated the description: use double quotes for strings because Haskell reserves single quotes for single characters, moved the section explaining de Bruijn sequences up top, and minor updates to spelling, grammar and markup. If you disagree with any change, it can be changed again.

  • JohanWiltink Avatar

    Shouldn't n^k be k^n?

  • JohanWiltink Avatar

    Needs performance tag and an indication of the required performance. n>1 is a bit unlimited.

    • gschandan Avatar

      This comment has been hidden.

    • JohanWiltink Avatar

      ( Please note CW does not generate notifications for spoilered replies. You can reply unspoileredly as well to draw attention to a spoilered one. )

      I have not actually tried all naive approaches, but I tried at least two that timed out.

      I think my solution is O(n ^ k+1). You have to return a list of length n^k, so better than that should be plain impossible, and you'll always have some additional overhead.

      If you really want to do performance checking well, you'll need solutions of specific complexities that you want to time out to test your tests with.

      Reasoning about time complexities is not easy here. You could just leave it at "such and such k, such and such n". Solvers know they have to generate n^k, so the worst case is known, and will preclude naive solutions.

    • gschandan Avatar

      Thanks for the explanation and tips. RE: your last point, so would this be appropriate: Ω(k^n) and O(k!^(k^(n-1))/(k^n)) image title As we know at worst, they will generate every single de Bruijn sequence and then sort them? I'll do some more testing anyway and see what I can workout.

    • JohanWiltink Avatar

      I don't think anyone will figure out that last big-O. I have seen worse, but it's quite ridiculous. :P

      I actually think "O(n), where n is length of output" would be the most understandable way of saying you have to be quite fast. And with tests ( or a test, at least ) of size 8^7, about 2 million, I can't imagine anything slower than that will work.

    • gschandan Avatar

      That is true, that upper bound is probably too broad 😅 I have amended the description as suggested and added the performance tag, many thanks.

    • JohanWiltink Avatar
      Suggestion marked resolved by JohanWiltink 4 years ago