Skip Navigation

Not everything can be done in constant time, that's O(k)

41

You're viewing part of a thread.

Show Context
41 comments
  • honestly I was very suspicious that you could get away with only calling the hash function once per permutation , but I couldn't think how to prove one way or another.

    so I implemented it, first in python for prototyping then in c++ for longer runs... well only half of it, ie iterating over permutations and computing the hash, but not doing anything with it. unfortunately my implementation is O(n²) anyway, unsure if there is a way to optimize it, whatever. code

    as of writing I have results for lists of n ∈ 1 .. 13 (13 took 18 minutes, 12 took about 1 minute, cant be bothered to run it for longer) and the number of hashes does not follow n! as your reasoning suggests, but closer to n! ⋅ n.

    desmos graph showing three graphs, labeled #hashes, n factorial and n factorial times n

    link for the desmos page

    anyway with your proposed function it doesn't seem to be possible to achieve O(n!²) complexity

    also dont be so negative about your own creation. you could write an entire paper about this problem imho and have a problem with your name on it. though I would rather not have to title a paper "complexity of the magic lobster party problem" so yeah

You've viewed 41 comments.