Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: A question:...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 27 of 29 Topic 26059 of 26821
Post > Topic >>

Re: A question: Is 200,000 element array worth sorting and search?

by mike-yue <needpassion@[EMAIL PROTECTED] > May 5, 2008 at 10:28 AM

On May 5, 9:58=A0am, "rio" <a...@[EMAIL PROTECTED]
> wrote:
> "CBFalconer" <cbfalco...@[EMAIL PROTECTED]
> ha scritto nel
messaggionews:481E5A93.=
90259CC4@[EMAIL PROTECTED]
> =A0 for (i =3D 0; i <=3D 200000; i++) {
> > =A0 =A0 =A0if (a[i] =3D=3D item) break;
> > =A0 }
> > =A0 if ((i <=3D 200000) && (a[i] =3D=3D item)) return i;
> > =A0 else =A0 =A0 =A0 =A0/* failure */ =A0 =A0 =A0 =A0 =A0 =A0return
-1;
>
> why not
>
> =A0 =A0if(a) for (i =3D 0; =A0i<=3D200000; ++i)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {if (a[i] =3D=3D item) =A0return
=
=A0 i;}
> =A0 =A0else =A0return =A0 -1;

Don't you think:
   for (i =3D 0;  i<200000; ++i)
if the condition i<=3D200000, the array will overflow.
 




 29 Posts in Topic:
A question: Is 200,000 element array worth sorting and search?
mike-yue <needpassion@  2008-05-04 15:27:30 
Re: A question: Is 200,000 element array worth sorting and searc
James Harris <james.ha  2008-05-04 15:51:50 
Re: A question: Is 200,000 element array worth sorting and searc
cri@[EMAIL PROTECTED] (R  2008-05-04 22:57:09 
Re: A question: Is 200,000 element array worth sorting and searc
Richard Heathfield <rj  2008-05-04 23:14:34 
Re: A question: Is 200,000 element array worth sorting and searc
Peter Nilsson <airia@[  2008-05-04 16:34:38 
Re: A question: Is 200,000 element array worth sorting and searc
mike-yue <needpassion@  2008-05-04 17:01:40 
Re: A question: Is 200,000 element array worth sorting and searc
Richard Heathfield <rj  2008-05-05 00:13:59 
Re: A question: Is 200,000 element array worth sorting and searc
Ian Collins <ian-news@  2008-05-05 12:46:28 
Re: A question: Is 200,000 element array worth sorting and searc
Keith Thompson <kst-u@  2008-05-04 17:26:57 
Re: A question: Is 200,000 element array worth sorting and searc
Charlton Wilbur <cwilb  2008-05-04 20:25:32 
Re: A question: Is 200,000 element array worth sorting and searc
CBFalconer <cbfalconer  2008-05-04 20:53:39 
Re: A question: Is 200,000 element array worth sorting and searc
Richard Heathfield <rj  2008-05-05 02:24:59 
Re: A question: Is 200,000 element array worth sorting and searc
Chris Torek <nospam@[E  2008-05-05 02:36:24 
Re: A question: Is 200,000 element array worth sorting and searc
CBFalconer <cbfalconer  2008-05-05 02:39:40 
Re: A question: Is 200,000 element array worth sorting and searc
Richard Heathfield <rj  2008-05-05 07:46:06 
Re: A question: Is 200,000 element array worth sorting and searc
Keith Thompson <kst-u@  2008-05-05 01:25:54 
Re: A question: Is 200,000 element array worth sorting and searc
CBFalconer <cbfalconer  2008-05-05 18:59:13 
Re: A question: Is 200,000 element array worth sorting and searc
Richard Heathfield <rj  2008-05-06 02:39:15 
Re: A question: Is 200,000 element array worth sorting and searc
CBFalconer <cbfalconer  2008-05-05 22:52:39 
Re: A question: Is 200,000 element array worth sorting and searc
Richard Heathfield <rj  2008-05-06 03:27:46 
Re: A question: Is 200,000 element array worth sorting and searc
"rio" <a@[EM  2008-05-05 18:58:38 
Re: A question: Is 200,000 element array worth sorting and searc
Antoninus Twink <nospa  2008-05-05 11:15:51 
Re: A question: Is 200,000 element array worth sorting and searc
James Harris <james.ha  2008-05-05 03:43:01 
Re: A question: Is 200,000 element array worth sorting and searc
mike-yue <needpassion@  2008-05-05 10:18:30 
Re: A question: Is 200,000 element array worth sorting and searc
Keith Thompson <kst-u@  2008-05-05 12:50:07 
Re: A question: Is 200,000 element array worth sorting and searc
mike-yue <needpassion@  2008-05-05 10:24:37 
Re: A question: Is 200,000 element array worth sorting and searc
mike-yue <needpassion@  2008-05-05 10:28:50 
Re: A question: Is 200,000 element array worth sorting and searc
mike-yue <needpassion@  2008-05-05 14:03:30 
Re: A question: Is 200,000 element array worth sorting and searc
CBFalconer <cbfalconer  2008-05-05 18:53:17 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 9 0:54:39 CDT 2008.