Re: A "How would you do this" type of question.
- From: "Rob Thorpe" <robert.thorpe@xxxxxxxxxxxx>
- Date: 27 Sep 2006 15:58:56 -0700
Korto wrote:
Imagine you are writing a program that will display a map of the United
States. Your program will ask a user to input their ZIP code. Once
they do, a dot will appear on the map to indicate where that ZIP code
is located.
My question is, how would you go about doing something like this, in
general?
Would you have a file of all ZIP codes and their longitude, latitude
coords and extrapolate those to x,y coords on your graphic map? Or, is
there an easier way?
This is just something that I was thinking about
today and I have no idea what mechanism anyone would use to accomplish
it.
Right now, I'm thinking the easiest way is using the file set-up I
mentioned above. Does anyone else have a different mechansim that
would be better?
Unless the data table is huge make the program parse it into a data
structure then lookup from the data structure. A hash-map of structs
would be suitable for example.
Also, if speed is of the essence consider precalculating the mapping
between longitude, latitude & the spatial coordinates on your map and
keep that in memory too.
.
- References:
- A "How would you do this" type of question.
- From: Korto
- A "How would you do this" type of question.
- Prev by Date: Re: the lowest number of comparisons in string matching
- Next by Date: Re: A "How would you do this" type of question.
- Previous by thread: Re: A "How would you do this" type of question.
- Next by thread: Re: A "How would you do this" type of question.
- Index(es):
Relevant Pages
|