确定代码的时间复杂度 [英] Determining the Time Complexity of code

查看:50
本文介绍了确定代码的时间复杂度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道详细的时间复杂性此代码

I want to know the time complixity in details for this code

展开 | < span class =codeLinkonclick =selectAll(this);>选择 | 换行 | 行号

推荐答案

以及此代码的时间复杂性


and also the time complixity for this code pls


展开 | < span class =codeLinkonclick =selectAll(this);>选择 | Wrap | 行号


对于fun()的第一个平均复杂度,常量等于2.

第二个它太长了,没读过但是它的外观是河内塔的问题及其复杂性,例如在维基百科文章。
For the first average complexity of fun() is constant equals 2.
The second it too long, didn''t read it but it''s looks Towers of Hanoi problem and its complexity is explained e.g. in wikipedia article.


此外,使用代码标签可以帮助其他人阅读并提供帮助。
Also, using the code tag would help others read it and provide help.


这篇关于确定代码的时间复杂度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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