3 ms·
Well, if you variate generic arity N, you are going to get N^3 which is exponential. If you variate nest level M, you are indeed going to get 6 ^ N which is 'ju
by Aloraman 9y ago
Well, if you variate generic arity N, you are going to get N^3 which is exponential.
If you variate nest level M, you are indeed going to get 6 ^ N which is 'just' polynomial.
However, if you just look upon the code sample, in most case it is assumed that both N and M are variated, and if both of them are growing with same limiting behavior, then there is O(N^N) complexity. This complexity is even worse than factorial!
- unwind 9y agoUh it's been ... rather long since my last exposure to formal CS, but did you drop some 'M's?
- Aloraman 9y agoOh crap... yeah. I meant O(N^3) and O(6^M). If both are varied - O(N^M), if both are increasing with same order of magnitude, then complexity can be written as O(N^N) which is O(N! * e^N / sqrt(N))