Are there any real O(n^n) algorithms?

后端 未结 5 718
醉梦人生
醉梦人生 2021-02-01 03:19

Is there any real Algorithm with a time complexity O(n^n), that isn\'t just a gimmick?

I can create such an Algorithm, like computing n^n in O(n^n) / Θ(n^n):

<         


        
5条回答
  •  走了就别回头了
    2021-02-01 03:44

    There are many optimization problems that are essentially O(n!), i.e in data compression. The common algorithms for this all need to cheat one way or another (many rely on heuristics) but can't make sure that they have found the perfect result this way. I.e. choosing the optimal line filters during compression of a PNG image is such a problem that is comparatively easy to understand.

    Another example are algorithms to break encryption which can potentially be even worse than O(n!).

提交回复
热议问题