Announcement

Collapse
No announcement yet.

what's the 5 letter word with the most one-word anagrams?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    I'll gladly let you have all the set theory and epsilon-delta

    Comment


    • #17
      I particularly liked how instead of writing something that counted +1 every time it found a match instead I wrote to a temp file and grep -c for 1s in that temp file.

      12-17-10 Mohamed Bouazizi NEVER FORGET
      Stadtluft Macht Frei
      Killing it is the new killing it
      Ultima Ratio Regum

      Comment


      • #18
        To be honest, I responded how I did as soon as I saw your rvd6 function

        Comment


        • #19
          I'm lazy and copy-paste is way too easy.
          12-17-10 Mohamed Bouazizi NEVER FORGET
          Stadtluft Macht Frei
          Killing it is the new killing it
          Ultima Ratio Regum

          Comment


          • #20
            It takes all of three lines using loops. And you can generalize to strings of any length.

            Comment


            • #21
              It took me ~45 seconds to write that function. Thinking would have cost extra time.
              12-17-10 Mohamed Bouazizi NEVER FORGET
              Stadtluft Macht Frei
              Killing it is the new killing it
              Ultima Ratio Regum

              Comment


              • #22
                Code:
                int rvdn(int n, char* string, int stringlen) {
                for(int i = 0; i < stringlen; i++)
                   for(int j = i; j < stringlen; j++)
                      if(string[i] == string[j]) return 0;
                return 1; }
                Divide the time by about 4 for previewing and fixing tags

                Comment


                • #23
                  You could cut down the number of permutation that need to be checked by atleast an order of magnitude by forcing two of the letters to be vowels.
                  Companions the creator seeks, not corpses, not herds and believers. Fellow creators, the creator seeks - those who write new values on new tablets. Companions the creator seeks, and fellow harvesters; for everything about him is ripe for the harvest. - Thus spoke Zarathustra, Fredrick Nietzsche

                  Comment


                  • #24
                    Originally posted by Kuciwalker
                    We wrote that program correctly in my sophomore year of HS
                    goddamnit

                    "I hope I get to punch you in the face one day" - MRT144, Imran Siddiqui
                    'I'm fairly certain that a ban on me punching you in the face is not a "right" worth respecting." - loinburger

                    Comment


                    • #25
                      Originally posted by Kuciwalker
                      Code:
                      int rvdn(int n, char* string, int stringlen) {
                      for(int i = 0; i < stringlen; i++)
                         for(int j = i; j < stringlen; j++)
                            if(string[i] == string[j]) return 0;
                      return 1; }
                      Divide the time by about 4 for previewing and fixing tags
                      Never mind that n is completely unused, that it always returns 0, and this:

                      Code:
                      rvdn str = (sort str) == (nub $ sort str)


                      Yes, it isn't as fast to run. But it sure is easy to look at the line and think "hm, this checks if the given list (strings are lists of char in Haskell), sorted, is the same as the same given list, sorted, and with sequences of duplicate elements collapsed... so, in other words, it checks for whether there are any duplicate elements in a list."
                      This is Shireroth, and Giant Squid will brutally murder me if I ever remove this link from my signature | In the end it won't be love that saves us, it will be mathematics | So many people have this concept of God the Avenger. I see God as the ultimate sense of humor -- SlowwHand

                      Comment


                      • #26
                        Never mind that n is completely unused, that it always returns 0, and this:


                        i+1

                        I'm not sure why n went there.

                        Anyway, it's easier to detect bugs in mine than his, since his could be missing a line and you wouldn't notice.

                        Comment


                        • #27
                          Originally posted by Impaler[WrG]
                          You could cut down the number of permutation that need to be checked by atleast an order of magnitude by forcing two of the letters to be vowels.
                          Good idea . It took the execution time of my Haskell program for going through /usr/share/dict/words (234937 lines, 2486824 bytes) from ~1.7 seconds to ~1.5 seconds.

                          Originally posted by Kuciwalker
                          Anyway, it's easier to detect bugs in mine than his, since his could be missing a line and you wouldn't notice.
                          Quite true... it's too bad that my version is too short to find any bugs in .
                          This is Shireroth, and Giant Squid will brutally murder me if I ever remove this link from my signature | In the end it won't be love that saves us, it will be mathematics | So many people have this concept of God the Avenger. I see God as the ultimate sense of humor -- SlowwHand

                          Comment


                          • #28
                            Code:
                            rvdn :: (Eq a) => [a] -> Bool -- to keep the monomorphism  restriction from biting you
                            rvdn = any (\x -> (head x) `elem` (tail x)) . init . tails
                            I'm really just playing around, trying to learn stuff in Haskell, but I figured that it was appropriate to post this different version of this function because it's better in a number of ways:

                            - it can deal with types for which equality is defined but order isn't, that is, you can pass it stuff like complex numbers
                            - it can deal with some limited cases of infinite lists and lists with undefined elements that the sorting version couldn't
                            - it probably performs a bit better than the earlier version
                            - it's pointlesspoints-free
                            Last edited by Ari Rahikkala; December 1, 2006, 21:39.
                            This is Shireroth, and Giant Squid will brutally murder me if I ever remove this link from my signature | In the end it won't be love that saves us, it will be mathematics | So many people have this concept of God the Avenger. I see God as the ultimate sense of humor -- SlowwHand

                            Comment


                            • #29
                              - it can deal with types for which equality is defined but order isn't, that is, you can pass it stuff like complex numbers


                              You can order complex numbers

                              Comment


                              • #30
                                Originally posted by Kuciwalker
                                You can order complex numbers
                                Not with the usual definition of an ordered field.

                                See here, for example.
                                "The avalanche has already started. It is too late for the pebbles to vote."
                                -- Kosh

                                Comment

                                Working...
                                X