某个算法的时间复杂度递归式T(n)=T(n-1)+n,其中n为问题的规模,则该算法的渐进时间复杂度为(62),若问题的规模增加了16倍,则运行时间增加(63)倍。
2023-09-01
B.O(nlgn)
C.O(n2)
D.O(n2lgn)
参考答案:C
对于递归式,假设T(1)=1,则:
T(n)=T(n-1)+n
=T(n-2)+n-1+n
=T(n-3)+n-2+n-1+n
=1+2+…+n-1+n
=n(n+1)/2
可见,时间复杂度为O(n2)。若问题的规模增加了16倍,则运行时间增加了162=256倍。
![]( //img1.runjiapp.com/duoteimg/tiku/images/pc/questionBank/main-list-title-icon.png)
![](https://img1.runjiapp.com/duoteimg/tiku/banner/bn_77.jpg)
残疾军人退出现役,需要配置假肢、代步三轮车等辅助器械的,由()负责解决。
2023-06-03
从业资格其它
![](https://img1.runjiapp.com/duoteimg/tiku/banner/bn_34.jpg)
![](https://img1.runjiapp.com/duoteimg/tiku/banner/bn_9.jpg)
下列各项中,关于现役军人死亡一次性抚恤金的发放顺序的表述,不正确的是()。
2023-06-03
从业资格其它
![](https://img1.runjiapp.com/duoteimg/tiku/banner/bn_76.jpg)
![](https://img1.runjiapp.com/duoteimg/tiku/banner/bn_59.jpg)
因战、因公一级和二级残疾的军人护理费为当地职工月平均工资的( )。
2023-06-03
从业资格其它
![](https://img1.runjiapp.com/duoteimg/tiku/banner/bn_64.jpg)
2023-06-03
从业资格其它
![](https://img1.runjiapp.com/duoteimg/tiku/banner/bn_86.jpg)
2023-06-03
从业资格其它
![](https://img1.runjiapp.com/duoteimg/tiku/banner/bn_18.jpg)
我国优抚工作中的抚恤是指对(),按照国家规定的标准给予的抚恤金优待。
2023-06-03
从业资格其它
热门标签