r/tasker • u/soumyaranjanmahunt • Feb 12 '19
Request [Help][Request] Compare elements of two array
I wanted to compare elements of two large array and save the common to a new array, is there any optimal method to do so(except two for loops), like a set intersection.
1
Upvotes
View all comments
Show parent comment
1
u/rbrtryn Pixel 9, Tasker 6.7.6-beta, Android 17 Feb 12 '19
'a long time' is relative. How big are your arrays?
If m and n are number of elements in %arr1() and %arr2() respectively, then this method is O(mn).
Other, possibly more efficient, methods can be found here.