Jul 3, 2013 at 10:49am UTC
how to define the big o notation for this?
Jul 4, 2013 at 2:48pm UTC
You haven't show the definition of Tree, but from the presence of
, I'm inferring this is a binary tree of some sort.
For a binary tree, big O should be:
Jul 4, 2013 at 3:04pm UTC
It visits all the nodes so it is not O(log n).
Last edited on
Jul 4, 2013 at 3:07pm UTC
Jul 6, 2013 at 8:40am UTC
so u guys think hats is the answer?
it's visit all the nodes
Jul 6, 2013 at 9:08am UTC
We have not given you the answer in big O notation like you asked for. I'm not going to give it to you because it looks like homework but if you know that it visits all the nodes once it shouldn't be hard to figure out.
Jul 6, 2013 at 10:12am UTC
it's is not an homework . example
to determine the big o for my understanding.
just choose the upper Big O and take its as my complexity
i just want to know since it's not an while loop or for loop.
and i can't really get it how to determine the Big O
the recursive function i search at google
it's O( n . log n )
Jul 6, 2013 at 3:07pm UTC
i might add that the runtime of this algorithm isn't all depending on the complexity,
the algorithm contains a lot of function calls, this will cause considerable overhead.