I have an algorithm that is based on a tree and depends on two input sizes n and m, where n is the number of edges a node can have and m is the number of leaves.
I want to find Big-O of an algorithm that traverses said tree and it breaks down to the following formula for the number of nodes.
$m = n^x$
$x = log_n(m)$
$\frac{n^{x+1}-1}{n - 1} = \frac{n*n^x-1}{n - 1} = \frac{n*n^{log_n(m)}-1}{n - 1} = \frac{n*m - 1}{n-1} = O(?)$
Is Big-O of the Formula $O(m*n)$ or $O(m)$ because $n$ cancels out? Thank you in advance!
PS: I know that if $O(m)$ is the upper bound $O(m*n)$ is an upper bound too, I want to find the tightest. I asked this question because in my understanding $n$ should cancel out, but that would mean the complexity of the traversal is independent on the number of edges a node can have, and I think that is wrong.