Hi All:
Thank you all for the help you ever gave.
kevin liu schrieb:
But this algorithm takes a long time to compare, could you please
help to improve this piece of
code to less the time needed?
Thanks in advance.
I don't know if it's faster, but you can also use
Hi Kevin and all,
John W. Krahn wrote:
As to whether the algorithm Rob presented is the "best" algorithm, that
depends on the data being used and how often this operation needs to be
preformed.
For example, the algorithm I presented above has a best case of O( 1 )
while the one Rob present
On Wed, Feb 11, 2009 at 11:07, kevin liu wrote:
snip
>> But this will still take O( n * m ) if all the elements of @nwarray0 are in
>> @nwarray1.
>>
>> If the elements of @nwarray1 are sorted then you could a binary search on
>> it and reduce your worst case to O( n * log m ).
>
> But how coul
kevin liu wrote:
On Wed, Feb 11, 2009 at 11:22 PM, John W. Krahn wrote:
The best you can do with two arrays is exit as soon as an element of
@nwarray0 is not found in @nwarray1:
my $found = 1;
SEARCH:
foreach my $srctemp ( @nwarray0 ) {
foreach my $tgttemp ( @nwarray1 ) {
if ( $tgtt
On Wed, Feb 11, 2009 at 11:22 PM, John W. Krahn wrote:
> kevin liu wrote:
>
>> Hi everybody:
>>
>
> Hello,
>
>
> I have two arrays(@nwarray0 and @nwarray1) in my program and i want
>> to make sure that
>> all the elements in @nwarray0 could be found in @nwarray1.
>>Here is my implementat
:) Rob
Thank you very much for your help.
Finally, I got this figured out.
[?]
On Wed, Feb 11, 2009 at 9:47 PM, Rob Dixon wrote:
> kevin liu wrote:
> > Hi everybody:
> >
> > I have two arrays(@nwarray0 and @nwarray1) in my program and i
> want
> > to make sure that
> > all the
kevin liu wrote:
Hi everybody:
Hello,
I have two arrays(@nwarray0 and @nwarray1) in my program and i want
to make sure that
all the elements in @nwarray0 could be found in @nwarray1.
Here is my implementation:
---
for
kevin liu wrote:
> Hi everybody:
>
> I have two arrays(@nwarray0 and @nwarray1) in my program and i want
> to make sure that
> all the elements in @nwarray0 could be found in @nwarray1.
> Here is my implementation:
> ---
>
On Wed Feb 11 2009 @ 4:04, kevin liu wrote:
> Hi everybody:
>
> I have two arrays(@nwarray0 and @nwarray1) in my program and i want
> to make sure that all the elements in @nwarray0 could be found in @nwarray1.
Check 'perldoc -q array' - two or three of the FAQ answers touch on
different
Hi Kevin,
kevin liu wrote:
I have two arrays(@nwarray0 and @nwarray1) in my program and i want
to make sure that
all the elements in @nwarray0 could be found in @nwarray1.
Your problem is a common problem that is not specific to Perl. A common
solution is to place one of the arra
11 matches
Mail list logo