Let's say I have a problem which depends on two variables, $m$ and $n$. I also have two algorithms for solving the problem. How do I decide which algorithm to use?
For example, say I have an array of unique numbers $A$, not necessarily sorted, and a second sorted array $B$. I want to create a third array $C$ which contains how many times each number in $A$ appears in $B$.
Algorithm 1 runs in time $O(m \lg n)$ and algorithm 2 in $O(m \lg m + n)$.
It seems to me I would need to divide into three cases:
- $n\gg m$
- $m \gg n$
How would I generally proceed from here?