In calculation of factorial of a no. Which is the fastest method ( importing module, by recursion, by for loop)?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

In calculation of factorial of a no. Which is the fastest method ( importing module, by recursion, by for loop)??

About factorial..

10th Apr 2020, 4:15 AM
Shivansh Sharma
Shivansh Sharma - avatar
3 Answers
+ 2
Recursion is a bit slower than loop due to overheads of function calls. Loop is faster. Module function performance depends on the library implementation. It is usually the fastest (for example, it can use pre-calculated values).
10th Apr 2020, 7:35 AM
andriy kan
andriy kan - avatar
- 1
And what about using module?
10th Apr 2020, 4:19 AM
Shivansh Sharma
Shivansh Sharma - avatar
- 1
Agreed...👍
10th Apr 2020, 8:48 AM
Shivansh Sharma
Shivansh Sharma - avatar