We have two lists, let\'s say students and their scores. I want to compare these two lists and find the delta between the new list and the old list, then find the least intrusi
If you're looking for a general, language-agnostic solution, then you're looking for some kind of data synchronization of ordered lists. The basic algorithm would be:
i1 = 0
i2 = 0
while (i1 < list1.size && i2 < list2.size)
{
if (list1[i1] < list2[i2])
{
//list1[i1] is not in list2
i1++
}
else if (list1[i1] > list2[i2])
{
//list2[i2] is not in list1
i2++
}
else
{
//item is in both lists
i1++
i2++
}
}
if (i1 < list1.size)
//all remaining list1 items are not in list2
if (i2 < list2.size)
//all remaining list2 items are not in list1