Hello, how to find the list element that whether it is on other lists or not? I know by the loop method (found= True). If you know better way please let me know. Thanks. L1 = [1,2,3,4,5] L2=[2,3,6] L3=[1,6,8] L4 = [3,10] result: 1: L1,L3 2: L1,L2 3: L1,L2,L4 6: L2,L3
comingsoon · Apr 25, 2013 10:11 PM · 12,257 views
not sure if this is the best way to do it: load the elements to python disctionary ( that would be O(n) operation) for each element in array, check if it exists in the disctionary , that would be another O(n) operation because hash lookup is O(1)
nepalinanu2013 · Apr 26, 2013 1:26 AM
This conversation is preserved exactly as it was on the original Sajha.com and can't accept new replies.
Start a New Discussion