Re: iPhone: validate a NSString for US zipcode
Re: iPhone: validate a NSString for US zipcode
- Subject: Re: iPhone: validate a NSString for US zipcode
- From: "Sean McBride" <email@hidden>
- Date: Thu, 7 Jan 2010 16:57:57 -0500
- Organization: Rogue Research Inc.
On 1/7/10 1:44 PM, David Duncan said:
>> To help make this thread more Cocoa-y, I would like to ask: Do the
>NSSet and NSArray methods like -containsObject perform in a fashion
>comparable to a home-rolled binary search? I greatly prefer to use the
>Cocoa stuff rather than try to remember/learn how to properly code such
>things.
>
>Since NSArray is unordered I would not expect its containsObject to do
>better than O(n). If NSSet is an ordered container, it should be able to
>do O(lg n). I don't believe we give any guarantees as to performance of
>these methods however, but a simple implementation of either data
>structure would likely give you these performance characteristics.
CFArray.h does discuss performance. And there exists a
CFArrayBSearchValues().
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden