Q:

Create a list consisting of those integers that appear in both lists

Problem statement:

Design an algorithm that, given two lists of integers, creates a list
  consisting of those integers that appear in both lists (each integer
  on the final list should appear only once). Describe your algorithm in
  terms of a pseudocode focusing on main algorithmic tasks and not on
  low-level details. Analyze the running time of your algorithm. You
  will get full credit only if your algorithm achieves an asymptotically
  better worst-case performance than Θ(n^2), where n is the sum of the
  lengths of the two input lists

Can someone explain to me what this question is actually asking me to do? 
My attempt:
I was under the impression that this question was telling me to make a algorithm that has two lists, idk, so maybe two arrays, one A, one B, where those arrays would be filled with numbers and I would take both of those lists and essentially put them together? I used MergeSort to sort them (which now I think may not be necesarry) then I used Merge to put the two lists actually together.
Question:
I am being told that is wrong. I'm thinking I must be misinterpeting the question. I also used merge sort because its O(nlogn).
What is the problem with my answer, what am I missing?

A:

The question asks you to find the intersection set of the two lists, or in other words - a list that contains only the elements that appear both in A and in B (but not elements that appear only in one of them).
It seems your algorithm is just combining the lists, and thus includes elements that appear only in one list.
There are several ways to do it:

Sort both lists, then iterate in parallel
Insert one list to hash table, then iterate the 2nd and print elements in the hash table (remember to remove elements found to avoid printing elements twice)
Same approach as (2), but uses a Tree-Set instead, to ensure O(nlogn) worst case.

I deliberately left the implementation details vague, so you can solve this assignment on your own.
Good luck!

