Example of O(n!)?

后端 未结 16 2410
渐次进展
渐次进展 2020-11-30 22:20

What is an example (in code) of a O(n!) function? It should take appropriate number of operations to run in reference to n; that is, I\'m asking a

16条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 22:46

    See the Orders of common functions section of the Big O Wikipedia article.

    According to the article, solving the traveling salesman problem via brute-force search and finding the determinant with expansion by minors are both O(n!).

提交回复
热议问题