Array Help

1. Junior Member
Join Date
Dec 1969
Posts
4

## Array Help

I am trying to compare two arrays and input the common values into a third array. This is the code but it does not seem to work.<BR><BR>There are already values in arrtheme1 and arrtheme2 which are defined as arrtheme1(50,2) and arrtheme2(50,2)<BR><BR>dim resultarr1(50,2)<BR>for j= 1 to 50<BR>for L = 1 to 50<BR>if arrtheme1(j,2)=arrtheme2(L,2) then<BR>Weight1 = arrtheme1(L,1)<BR>Weight2 = arrtheme2(L,1)<BR>Weight = Weight1 * Weight2<BR>Movie = arrtheme2(L,0)<BR>Themeid = arrthemseL(l,2)<BR>resultarr1(L,0) = Movie<BR>resultarr1(L,1) = Weight<BR>resultarr1(L,1) = Themeid<BR>end if<BR>next<BR>next<BR><BR>Help Please?<BR>Thanks,<BR>-Aman

2. Senior Member
Join Date
Dec 1969
Posts
11,247

## RE: Array Help

OK you realise your comparing looping 50 ^ 50!<BR>It is not efficient<BR>1) order your arrays<BR>2) compare &#062; and next the loop<BR>3) sitback and wait!

3. Junior Member
Join Date
Dec 1969
Posts
4

## RE: Array Help

Hi White Knight,<BR><BR>I know this is not efficient, but this seems to the the only way. What do u mean order your arrays?? You mean Bubble Sort or something? Could you please be specific abt compare &#062; and next the loop<BR><BR>Thanks a ton,<BR>-Aman

4. Senior Member
Join Date
Dec 1969
Posts
11,247

## RE: Array Help

Yes Bubblesort<BR>dim resultarr1(50,2)<BR>for j= 1 to 50<BR> for L = 1 to 50<BR> if arrtheme1(j,2)=arrtheme2(L,2) then<BR> Weight1 = arrtheme1(L,1)<BR> Weight2 = arrtheme2(L,1)<BR> Weight = Weight1 * Weight2<BR> Movie = arrtheme2(L,0)<BR> Themeid = arrthemseL(l,2)<BR> resultarr1(L,0) = Movie<BR> resultarr1(L,1) = Weight<BR> resultarr1(L,1) = Themeid<BR> elseif arrtheme1(j,2)&#062; arrtheme2(L,2) <BR> exit &#039;&#060;-- I think this is it but not entirely sure<BR> end if<BR> next<BR>next

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•