Kistaro Windrider, Reptillian Situation Assessor (kistaro) wrote,
Kistaro Windrider, Reptillian Situation Assessor
kistaro

  • Mood:

The Permutor

Okay, ubergeek time here.

A well-known fact is that I play on TopCoder. I do so with great regularity, and enjoy the challenge- I'm not that great at the game, but it's a lot of fun.

Something I've missed more than once: something where I can give it a pile of objects (a Set or an array) and it will consecutively spit out every possible ordering of those objects. A standardized Object that makes brute force much, much simpler to implement- and makes it possible to do so iteratively, without need for dangerous levels of recursion.

I have built my masterpiece. I have built the Permutor. It is the generalized solution to the "find all permutations" problem. It runs, as it must, in factorial time, but that's because the raw size of the output increases in a factorial manner; it's as streamlined as I could make it.

Now that I've solved it, I never have to solve the problem again! The Permutor has been written- and I will never need to do it again.

Anybody curious about the source code is welcome to it- but TopCoder players, please remember that all library code must be your own. Write your own version- probably a better one. Want it for something else? Y'all are welcome to it.

It's sad. I feel like this is the biggest thing I've accomplished all month, and I am also fully aware that for most purposes, the Permutor is almost completely useless, as any brute force that runs in n! time is rarely the solution called for.
Subscribe

  • Last LJ post

    Hey all, I joined the LJ exodus train before it was cool</hipster>, but with recent developments in LiveJournal server location (…

  • (no subject)

    I want to assemble things that nobody else could ever assemble, and when they are done, I want to have done it in ways that nobody of average skill…

  • Failing, etc.

    That feeling of being 99% sure a social space would have been better for everyone without you in it, but you can't apologize or talk about it or…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 6 comments