(n)
| 33 | factorial(14) # 130 |
| 34 | |
| 35 | def factorial(n): |
| 36 | # 23 calls total |
| 37 | # 170 ticks total, 150 ticks local |
| 38 | # 3 primitive calls, 130, 20 and 20 ticks total |
| 39 | # including 116, 17, 17 ticks local |
| 40 | global TICKS |
| 41 | if n > 0: |
| 42 | TICKS += n |
| 43 | return mul(n, factorial(n-1)) |
| 44 | else: |
| 45 | TICKS += 11 |
| 46 | return 1 |
| 47 | |
| 48 | def mul(a, b): |
| 49 | # 20 calls |
searching dependent graphs…