Skip to main content
Post Reopened by Yves Klett, ciao, Karsten7, Michael E2, RunnyKine
Fixed typos
Source Link
Michael E2
  • 244.8k
  • 18
  • 351
  • 774

I have 2 Lists, yhe. The first one includes all the numbers from 1 to 10.

listA={1,2,3,4,5,6,7,8,9,10}. 

The second includes random numbers, like this:

listB={2,10,2,5,7,15,1000,7,25,600}. 

I want to find an algorithm that will take any number of the second list listB and compare it to all numbers in listA. If the numbers equalsnumber in listB is equal to a number in listA, I"ll get 1 as a result. If not it will be 0. As a final result I would like to sum all equal numbers.

Here, for example we have the result 6 because we can find 2 (twice), 7 (twice), 5 and 10 in the two lists. I need a general way because my lists includes data of 10,000 numbers.

Regards. Danny

I have 2 Lists, yhe first one includes all the numbers from 1 to 10.

listA={1,2,3,4,5,6,7,8,9,10}. 

The second includes random numbers, like

listB={2,10,2,5,7,15,1000,7,25,600}. 

I want to find an algorithm that will take any number of the second list listB and compare it to all numbers in listA. If the numbers equals I"ll get 1 as a result. If not it will be 0. As a final result I would like to sum all equal numbers.

Here, for example we have the result 6 because we can find 2 (twice), 7 (twice), 5 and 10 in the two lists. I need a general way because my lists includes data of 10,000 numbers.

Regards. Danny

I have 2 Lists. The first one includes all the numbers from 1 to 10.

listA={1,2,3,4,5,6,7,8,9,10}

The second includes random numbers, like this:

listB={2,10,2,5,7,15,1000,7,25,600}

I want to find an algorithm that will take any number of the second list listB and compare it to all numbers in listA. If the number in listB is equal to a number in listA, I"ll get 1 as a result. If not it will be 0. As a final result I would like to sum all equal numbers.

Here, for example we have the result 6 because we can find 2 (twice), 7 (twice), 5 and 10 in the two lists. I need a general way because my lists includes data of 10,000 numbers.

deleted 3 characters in body; edited title
Source Link
Jason B.
  • 70.2k
  • 3
  • 144
  • 298

Compare Tables or Lists Find the length of the intersection of two lists including duplicates

OK....I"ll try to be more clear. I have 2 Lists. TheLists, yhe first one includes all the numbers from 1 to 10. A={1,2,3,4,5,6,7,8,9,10}.

listA={1,2,3,4,5,6,7,8,9,10}. 

The second includes Randomrandom numbers, like B={2,10,2,5,7,15,1000,7,25,600}.

listB={2,10,2,5,7,15,1000,7,25,600}. 

I want to find an algorithm that will take any number of the second list (List B)listB and compare it to all numbers in List AlistA. If the numbers equals I"ll get 1 as a result. If not it will be 0. As a final result I would like to sum all equal numbers. Here

Here, for example we have the result 6 because we can find 2 (twice), 7 (twice), 5 and 10 in the two lists. Actually, I need a general way because my lists includes data of 10,000 numbers. 

Regards. Danny

Compare Tables or Lists

OK....I"ll try to be more clear. I have 2 Lists. The first one includes all the numbers from 1 to 10. A={1,2,3,4,5,6,7,8,9,10}. The second includes Random numbers, like B={2,10,2,5,7,15,1000,7,25,600}. I want to find an algorithm that will take any number of the second list (List B) and compare it to all numbers in List A. If the numbers equals I"ll get 1 as a result. If not it will be 0. As a final result I would like to sum all equal numbers. Here, for example we have the result 6 because we can find 2 (twice), 7 (twice), 5 and 10 in the two lists. Actually, I need a general way because my lists includes data of 10,000 numbers. Regards. Danny

Find the length of the intersection of two lists including duplicates

I have 2 Lists, yhe first one includes all the numbers from 1 to 10.

listA={1,2,3,4,5,6,7,8,9,10}. 

The second includes random numbers, like

listB={2,10,2,5,7,15,1000,7,25,600}. 

I want to find an algorithm that will take any number of the second list listB and compare it to all numbers in listA. If the numbers equals I"ll get 1 as a result. If not it will be 0. As a final result I would like to sum all equal numbers.

Here, for example we have the result 6 because we can find 2 (twice), 7 (twice), 5 and 10 in the two lists. I need a general way because my lists includes data of 10,000 numbers. 

Regards. Danny

added 151 characters in body
Source Link
Danny
  • 221
  • 1
  • 6

SupposeOK....I"ll try to be more clear. I have 2equal length lists or tables with random2 Lists. The first one includes all the numbers between i= 1…from 1 to 10.n, Let's say A= A={201, 72, 4003, 56…………4,5,6,7,8,9,10}. The second includes Random numbers, like B={2,10,2,5,7, 1215, 10001000, 877,….25,600} I would like. I want to havefind an algorithm that choose eachwill take any number of the elements in Table A and matchsecond list (List B) and compare it with every elementto all numbers in Table BList A. If the numbers are the sameequals I"ll get 1 as a result. If not it will be 0. As a final result I would like to count it, If not it stay Nullsum all equal numbers. In other words Here, for example we have the result will be6 because we can find 2 (twice), 7 (twice), 5 and 10 in the summation of equal number elementstwo lists. If they are 35 so I'll get 35 asActually, I need a resultgeneral way because my lists includes data of 10,000 numbers. Can someone help with the right algorithm? Regards. Danny

Suppose I have 2equal length lists or tables with random numbers between i= 1….n, Let's say A={20, 7, 400, 56…………}, B={7, 12, 1000, 87,….} I would like to have an algorithm that choose each of the elements in Table A and match it with every element in Table B. If the numbers are the same I would like to count it, If not it stay Null. In other words, the result will be the summation of equal number elements. If they are 35 so I'll get 35 as a result. Can someone help with the right algorithm?

OK....I"ll try to be more clear. I have 2 Lists. The first one includes all the numbers from 1 to 10. A={1,2,3,4,5,6,7,8,9,10}. The second includes Random numbers, like B={2,10,2,5,7,15,1000,7,25,600}. I want to find an algorithm that will take any number of the second list (List B) and compare it to all numbers in List A. If the numbers equals I"ll get 1 as a result. If not it will be 0. As a final result I would like to sum all equal numbers. Here, for example we have the result 6 because we can find 2 (twice), 7 (twice), 5 and 10 in the two lists. Actually, I need a general way because my lists includes data of 10,000 numbers. Regards. Danny

Post Closed as "Needs details or clarity" by Martin Ender, RunnyKine, ciao, user9660, MarcoB
Source Link
Danny
  • 221
  • 1
  • 6
Loading