程序可以计算出一个算法的复杂性? [英] Can a program calculate the complexity of an algorithm?

查看:132
本文介绍了程序可以计算出一个算法的复杂性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么办法来计算编程算法的时间复杂度?例如,我怎么能计算出一个斐波纳契(N)功能?

Is there any way to compute the time complexity of an algorithm programatically? For example, how could I calculate the complexity of a fibonacci(n) function?

推荐答案

停机问题的不可判定说你甚至不能告诉我们,如果一个算法终止。我是pretty的肯定由此可以得出,你不能笼统地解决了算法的复杂性。

The undecidability of the halting problem says that you can't even tell if an algorithm terminates. I'm pretty sure from this it follows that you can't generally solve the complexity of an algorithm.

这篇关于程序可以计算出一个算法的复杂性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆