S
Sreedharamurthy K
Hi,
I've two string arrays A & B. One of it is sorted B. A is not sorted. Now I
want array A to be same as array B. So I was thinking the following is the
right way:
for (elements in B)
check if the element exists in A
if it exists, go to the next element
else add this element
for (elements in A)
check if the element exists in B
if it exists, go to the next element
else remove this element
Is there a better way to do this to reduce the number of string comparion;
doing it faster??
Sorry if it is trivial and has been answered earlier. I searched a little
but could not find any relevant ones...
TIA.
-- Sree
I've two string arrays A & B. One of it is sorted B. A is not sorted. Now I
want array A to be same as array B. So I was thinking the following is the
right way:
for (elements in B)
check if the element exists in A
if it exists, go to the next element
else add this element
for (elements in A)
check if the element exists in B
if it exists, go to the next element
else remove this element
Is there a better way to do this to reduce the number of string comparion;
doing it faster??
Sorry if it is trivial and has been answered earlier. I searched a little
but could not find any relevant ones...
TIA.
-- Sree