I have following Python code, a and b are lists(I know it isn't best way of getting intersections):
def get_intersection(a, b):
a = set(a)
b = set(b)
c = sorted(list(a&b))
return c
Let's call len(a) - m and len(b) - n, where is no additional information about a and b. Then time complexity of given code is O(m) + O(n) + O(m * n) + O((m + n) * log(m + n)).
I definitely can shorten O(m) and O(n), because they are much less than O(m * n), but what should I do with O((m + n) * log(m + n))?
How do i compare O(m * n) and O((m + n) * log(m + n))? Should I keep O((m + n) * log(m + n)) in final evaluation?