FROM : John Stiles
DATE : Thu Mar 13 22:27:47 2008
NSDictionary should be all you need here. It internally uses a hash
table to find keys, so it should be extremely fast.
Karan Lyons wrote:
> What's the best way to lookup something from a huge table?
> I'm trying to write a piece of code that checks weather data given
> a zipcode. But I first need to change that zipcode into another format
> in order for it to work with the online service I'm querying. For
> example:
>
> 1) User inputs zipcode 02139.
> 2) Application looks up zipcode in table and finds that 02139 is
> USMA0007
> 3) Application uses code USMA0007 to query the online service.
>
> The table itself is pretty simple: It's just two columns, one with
> every zipcode in the US, and the other with the corresponding weather
> code. But there are 41,805 zipcodes in the US, so I'm not sure of the
> best way to implement this. The table only needs to be queried once,
> after that I can store the weather code in memory.
> What's the best way to do this? Thanks for your help!
>
> Namaste,
> Karan
> ------------------------------------------------------------------------
>
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
DATE : Thu Mar 13 22:27:47 2008
NSDictionary should be all you need here. It internally uses a hash
table to find keys, so it should be extremely fast.
Karan Lyons wrote:
> What's the best way to lookup something from a huge table?
> I'm trying to write a piece of code that checks weather data given
> a zipcode. But I first need to change that zipcode into another format
> in order for it to work with the online service I'm querying. For
> example:
>
> 1) User inputs zipcode 02139.
> 2) Application looks up zipcode in table and finds that 02139 is
> USMA0007
> 3) Application uses code USMA0007 to query the online service.
>
> The table itself is pretty simple: It's just two columns, one with
> every zipcode in the US, and the other with the corresponding weather
> code. But there are 41,805 zipcodes in the US, so I'm not sure of the
> best way to implement this. The table only needs to be queried once,
> after that I can store the weather code in memory.
> What's the best way to do this? Thanks for your help!
>
> Namaste,
> Karan
> ------------------------------------------------------------------------
>
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>






Cocoa mail archive

