× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Frank, far be it from me to steal your joy.  <g,d,&r>

Dang those Canadiens, eh?

I won't even begin to guess how this can be shortened.  Typically, when I
look at a complex problem like this, I get a long continuous scrap of green
bar and sketch out scenarios.  I did this with my fanciful "subset sum
problem" that I detailed here last month.

I think I remember you mentioning this particular problem not too long ago.
I checked the archives and couldn't find it.  Could you either restate the
problem or provide an archive link?  Just looking at the code you provided
doesn't tell me what you're trying to accomplish.

There's gotta be a way.

db

> -----Original Message-----
> From: rpg400-l-bounces@xxxxxxxxxxxx / fkany@xxxxxxxxxxxxxxxxxx
> Sent: Tuesday, October 19, 2004 2:12 PM
>
> This program is a monster and I hope to never see another request for
> ranging canadian zip codes<fingers crossed>.  I've written a very small US
> zip code ranging program(less than 50 lines of code), but the letters in
> the canadian zip codes throws a wrench in the whole process of trying to
> make the program small.  I've tried to make the program as simple and easy
> to follow as possible. If someone else has a better way, be my guest, I'm
> open to ideas.
>
> Below are 2 subroutines: CHECK_6 and CHECK_56.
>
> CHECK_6(N):  The first 5 positions of the current zipcode and the previous
> zipcode match, it's easy to check if the 6th position is in sequence since
> it's numeric.  Only 9 different combinations to see if the current zipcode
> is in sequence with the previous zipcode.
>
> CHECK_56(AN): Here it gets a little more complicated and longer.
> There are
> 234 different combinations to validate the sequence of the zipcodes.  For
> each letter of the alphabet there can be 9 different
> comninations.(9*26=234)
>
> As you can imagine, the combinations keep multiplying.  CHECK_456(NAN):
> 234*10 = 2340 combinations, CHECK_3456(ANAN): 2340*26=60,840 combinations,
> CHECK_23456(NANAN): 60840*10=608,400 combinations!!!
>
> If someone else has an easier way to shorten this code, PLEASE fill me in,
> I'd certainly appreciate it.
>
> Frank


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.