This problem involves the time complexity of erasing entries that occur more than once in a list. I think it might be $n \log n$.
The input is a finite set $S$ and a finite list $T$ whose entries are in $S$. The size of the input is $n= |S|+ |T|$, where $|T|$ is the length of the list. The output is a list of the elements of $S$ that occur in the list $T$, an output list having no repeated elements of $S$. Does there exist a linear-time, $n p(\log n)$, where $p$ is a polynomial, or subquadratic-time algorithm for this problem?
I would be grateful for any ideas, direction, pseudo-code.