Skip to main content
4 events
when toggle format what by license comment
Apr 28, 2016 at 14:08 comment added LLlAMnYP @JasonB Tally gives the number of occurrences of the elements of the combined lists A and B but preserves the order in which the elements appear. Therefore the first Length@listA elements of Tally[listA~Join~listB] will give how many times the elements of listB appear in listA plus one. This hinges on the fact that all elements of listA must be distinct, but is otherwise more general than my solution, which demands listA === Range@Length@listA
Apr 28, 2016 at 13:56 comment added LLlAMnYP +1 for superior general solution. I'm very surprised, that Tally is so fast.
Apr 28, 2016 at 12:11 comment added Jason B. What is it doing, and why is it so much faster?
Apr 28, 2016 at 11:38 history answered ciao CC BY-SA 3.0