算法的复杂性 [英] Complexity of algorithms

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

问题描述

如何计算斐波纳契数列的时间复杂度.....是否有可能存在三种复杂性符号最佳情况最坏情况平均情况...如何计算这三种情况对于给定程序的复杂性...是每个程序都有三个复杂性..



我尝试过:



how can i calculate the time complexity of fibonacci series .....is there possible three notation of complexities best case worst case average case ...how to calculate this complexities of these three cases for a given program...is every program has three complexities..

What I have tried:

int Fibonacci(int n)
{
    if (n <= 1)
        return n;
    else
        return Fibonacci(n - 1) + Fibonacci(n - 2);
}

推荐答案

试试这些:



递归Fibonacci算法的复杂性 - 计算机科学堆栈交换 [ ^ ]



递归的时间复杂度分析 - 斐波那契序列 - YouTube [ ^ ]



递归和复杂性 [ ^ ]



什么是Fibonacci系列算法的空间和时间复杂性 [ ^ ]



快速上网搜索斐波那契复杂性,发现这些以及更多内容。





但请不要使用Fibonacci的递归。
Try these:

Complexity of recursive Fibonacci algorithm - Computer Science Stack Exchange[^]

Time Complexity analysis of recursion - Fibonacci Sequence - YouTube[^]

Recursion and Complexity[^]

What is the space and time Complexity of Fibonacci series algorithm[^]

A quick internet search for fibonacci complexity found these and many more.


But please don't use recursion for Fibonacci.


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

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