更好地举例说明问题:
提供输入list1和list2 :
list1 = [0,1,2,3,4]
list2 = [[0,1],[1],[2,3],[2],[4]]
list1[0] = 0 --> [0,1] of list2[0] (meaning that element 0 of list1 is mapped to element 0 and 1 of list2)
list1[1] = 1 --> [1] of list2[1] (meaning that element 1 is mapped to element 1)
list1[2] = 2 --> [2,3] of list2[2] (meaning that element 2 is mapped to element 2 and 3)
list1[3] = 3 --> [2] of list2[3] (meaning that element 3 is mapped to element 2)
list1[4] = 4 --> [4] of list2[4] (meaning that element 4 is mapped to element 4 itself)
所以,我想从list1和list2像这样列出:
outputlist=
[ [[0], [0]],
[[1], [0]],
[[2], [2]],
[[3], [2]],
[[4], [4]]
]
outputlist shows that:
1st element is identical to itself
2nd element is identical to first element
3rd element is identical to itself
4th element is identical to 3rd element
5th element is identical to itself
基本上,这是一个映射,显示list1的哪些元素相同。