|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Richard Heathfield <rjh@see.sig.invalid> writes:
> Keith Thompson said: > >> pereges <Broli00@gmail.com> writes: > > <snip> > >>> if(a[i] <= 50) >>> left_size++; >>> if(a[i] > 50) >>> right_size++; >> >> The second test is unnecessary. > > s/is unnecessary/can be replaced by else/ > > <snip> Right. -- Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst> Nokia "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister" |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Keith Thompson <kst-u@mib.org> writes:
> Richard Heathfield <rjh@see.sig.invalid> writes: >> Keith Thompson said: >> >>> pereges <Broli00@gmail.com> writes: >> >> <snip> >> >>>> if(a[i] <= 50) >>>> left_size++; >>>> if(a[i] > 50) >>>> right_size++; >>> >>> The second test is unnecessary. >> >> s/is unnecessary/can be replaced by else/ >> >> <snip> > > Right. I prefer your correction because the whole second test *is* unnecessary. The OP needs to write 'size_of_array - left_size' in the allocation but that is all. At first reading I thought that was what you intended. -- Ben. |
|
![]() |
| Outils de la discussion | |
|
|