Hi, everyone. Anyone can help me about this exercise? How to write a class called NFactorial with a method with the signature

which takes running time in proportion to n!Code:`public void run (int n)`

Thanks!

Printable View

- 06-23-2013, 09:45 AMhjxlppHow to write the time complexity about n!
Hi, everyone. Anyone can help me about this exercise? How to write a class called NFactorial with a method with the signature

Code:`public void run (int n)`

Thanks! - 06-23-2013, 10:05 AMJosAHRe: How to write the time complexity about n!
It all depends on what that method does; if it computes n! then it only does n multiplications (plus some minor stuff), so the big-Oh would be O(n); if, on the other hand, it runs a loop n! times, the big-Oh would be O(n!) ...

kind regards,

Jos