当前位置: 首页 > news >正文

建什么网站网站建设所需人力

建什么网站,网站建设所需人力,网站开发所使用的浏览器,哪家建站好数字拆分为斐波那契数列Description: 描述#xff1a; We are often used to generate Fibonacci numbers. But in this article, we are going to learn about how to search Fibonacci numbers in an array? 我们经常被用来产生斐波那契数。 但是在本文中#xff0c;我们…数字拆分为斐波那契数列Description: 描述 We are often used to generate Fibonacci numbers. But in this article, we are going to learn about how to search Fibonacci numbers in an array? 我们经常被用来产生斐波那契数。 但是在本文中我们将学习如何在数组中搜索斐波那契数 Introduction: 介绍 Fibonacci numbers are often used in mathematics and computer science fields. Fibonacci numbers are often considered as an important part of number theory because of their some amazing properties and the connection with the golden ratio. We are all familiar with Fibonacci number generation using dynamic programming or simple Fibonacci property. But to check a number whether its part of Fibonacci series or not is something really challenging. 斐波那契数通常用于数学和计算机科学领域。 斐波那契数通常被认为是数论的重要组成部分因为它们具有惊人的性质以及与黄金比率的联系。 我们都熟悉使用动态编程或简单的Fibonacci属性生成斐波那契数的方法。 但是要检查一个数字是否属于斐波那契数列确实是一项挑战。 搜索斐波那契数的算法 (Algorithms to search for Fibonacci numbers) The searching algorithm is linear search but what is challenging is to check for the number whether Fibonacci or not. 搜索算法是线性搜索但是具有挑战性的是检查是否为斐波那契数。 Brute force 蛮力 The brute force approach is to generate the Fibonacci series and to store that in an array. We need to generate the Fibonacci series till we cover the maximum element of the search array. Then we need to check each element of the search array whether its part of the new array consisting generated Fibonacci series. Needless to say, the brute force approach is not going to work for larger values since the complexity is much higher and the complexity also includes Fibonacci series generation which is an additional task here. 蛮力方法是生成斐波那契数列并将其存储在数组中。 我们需要生成斐波那契数列直到覆盖搜索数组的最大元素。 然后我们需要检查搜索数组的每个元素是否属于包含生成的斐波那契数列的新数组。 不用说强力方法不适用于较大的值因为复杂度要高得多并且复杂度还包括斐波那契数列生成这是此处的附加任务。 Using Mathematical formula 使用数学公式 Fibonacci numbers have an amazing property and one of the property is that for every Fibonacci number 斐波那契数字具有惊人的特性其中一个属性是每个斐波那契数字 n, 5n24 or 5n2-4 is a perfect square. n 5n2 4或5n2-4是一个完美的正方形。 Such property has made the checking possible in only 这样的属性使得检查仅在 O(1) time complexity and we dont need any additional storage. O(1)的时间复杂度我们不需要任何其他存储。 .minHeight{ min-height: 250px; } @media (min-width: 1025px){ .minHeight{ min-height: 90px; } } .minHeight{ min-height: 250px; } @media (min-width: 1025px){ .minHeight{ min-height: 90px; } } 用于搜索斐波纳契数的C 实现 (C implementation for searching Fibonacci numbers) #include bits/stdc.h using namespace std; int isSquare(int k){ // if k isnt perfect square then the square root //will be a float value but we are rounding it off to integer int ssqrt(k); // only in case of perfect square there //will not be any rounding off error if(s*sk) return 1; else return 0; } int checkFibo(int k){ //checking whether (5n^24) or (5n^2-4) is perfect square if(isSquare(5*k*k-4)||isSquare(5*k*k4)) return 1; else return 0; } void findFibos(int* a, int n){ int count0; for(int i0;in;i){ if(checkFibo(a[i])){ couta[i] ; count; } } if(count) cout\nabove count fibonacci numbers are present in the array\n; else cout\nno fibonacci number is present in the array; } int main(){ int n; // enter array length coutenter no of elements\n; cinn; int* a(int*)(malloc(sizeof(int)*n)); //fill the array coutenter elements................\n; for(int i0;in;i) scanf(%d,a[i]); findFibos(a,n); return 0; } Output (first run) 输出(首次运行) enter no of elements 6 enter elements................ 2 3 10 13 15 21 2 3 13 21 above 4 fibonacci numbers are present in the array Output (second run) 输出(第二次运行) enter no of elements 5 enter elements................ 6 7 11 12 14 no fibonacci number is present in the array 翻译自: https://www.includehelp.com/algorithms/search-a-fibonacci-number.aspx数字拆分为斐波那契数列
http://www.yutouwan.com/news/247285/

相关文章:

  • 做一元云购网站2021年10月新闻摘抄
  • 大连建设网站多媒体设计制作公司北京
  • 域名空间都有了怎么做网站如何网站切换
  • 青岛市蓝色经济区建设官方网站京东商城平台商户
  • 北京模板建站公司常见的网站建设技术
  • 商城网站建设天软科技新网站多久会被百度收录
  • 网站网络营销方式wordpress4.9怎么安装
  • 山东钢结构建设局网站做网站市场分析
  • 大学生网站建设与网页设计报告风险地区查询最新
  • 怀化租房网站郑州网站建设君捷
  • 建设银行网站功能介绍手机域名注册网站
  • 中国公路建设行业协会网站上网站地图怎么设置
  • 企业网站建设推广含义营销融合app
  • 网站建设_网站制作公司_捷创外贸建站优化推广
  • 龙岗网站优化教育机构招聘
  • 网站中文名称amh wordpress 邮件
  • 国外网站icp备案wordpress链接过期
  • 深圳专业seo外包重庆seo职位
  • 网站站群邹城市网站建设
  • 滁州网站建设推广通辽网站建设0475seo
  • 网站建设工作会议讲话app设计开发要多少钱
  • 研究院网站建设平面设计相关的网站有哪些
  • 网站建设 中山沈阳 商城 网站 开发
  • 昌平知名的网站制作建设报价设计签名的软件免费
  • 长春网站建设优化企业怎么找到那个网站
  • 网站的设计费用做网站包括备案吗
  • 网站开发费税率是多少常州专业网站建设公司咨询
  • 柳州专业网站建设加盟惠州seo排名收费
  • 渭南建设用地规划查询网站建筑资质人才网官网
  • mvc做网站用的多不多wordpress用户绑定手机