Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Finding sequences

Name: Anonymous 2013-02-06 8:23

So i got 70 fields ordered in a list, each field containing between 7 to 100 integers each, with each integer being unique. And i want to find sequences of some length of numbers such that there is an equal length between each number in the sequence and every number in the sequence is taken from it's own field, and that these fields are ordered one after the other.

To clarify: one sequence of length 5 could be made using a single number from each of the fields 46 to 51, if the difference between the numbers from field 46 and 47 was equal to the difference between the ones from 47 and 48 ... 50 and 51.

One way i thought about doing this was to instead to think about it like a continuous line from the smallest integer to the largest, with every field appearing were an integer it contains would be. And then just iterate over it, taking the first field i find, for example field 5. And then find every instance of the next field, 6 in this case, and see if there's a equal distance between those and a field 7 repeated for how long this sequence needs to be. If none is found grab the next appearing field and repeat.

Is there any better way of accomplishing this? Sorry for my shitty English anyhow.

Don't change these.
Name: Email:
Entire Thread Thread List