For C, when dealing with recursion where you will check the same state multiple times, getting the same result, use a method called memoization. (That's not a typo, there is no "r")
On Sep 3, 7:51 pm, Grant Kot <[email protected]> wrote: > yeah, this contest has told me that i really need to study up on algorithms. > it's also scary that the fast person completed all three in less than half > an hour. i got large and small for A and B correct but for C somehow I had a > recursive thing and it took forever and I couldn't figure out how to make it > faster so I ran out of time. for B my algorithm was pretty crappy, i just > looped through all the grid points, in order from left to right and top > down, found the basin that they flowed into, if it did not already have a > letter to go with it, i labeled that basin with the next letter in the > alphabet and also the grid point with the letter of the basin. it still > completed instantly, but i was not so lucky with C. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-code?hl=en -~----------~----~----~----~------~----~------~--~---
