For example,
bitmask({1, 2, 3, 4}, {2, 4})
returns
{False, True, False, True}
The naive way to do this is to map a membership function over the list:
map(lambda(x, member(x, subset)), list)
but that's O(n*m) and it can be done in O(n+m).
What's the best way to implement bitmask() in your favorite language?
PS: It doesn't actually matter if the second list is a subset of the first. However you implement it, any elements of the second list that are not in the first will simply be ignored.