Example of a factorial time algorithm O( n! )

前端 未结 4 716
情深已故
情深已故 2020-12-08 06:36

I\'m studying time complexity in school and our main focus seems to be on polynomial time O(n^c) algorithms and quasi-linear time O(nlog

4条回答
  •  借酒劲吻你
    2020-12-08 07:09

    Here is a simple example with Big O( n! ):

    This is in python 3.4

     def factorial(n):
        for each in range(n):
            print(n)
            factorial(n-1)
    

提交回复
热议问题