Time-compexity of algorithms

天大地大妈咪最大 提交于 2019-12-13 10:41:01

问题


Ok so I came across a question and I am confused about its answer. I have to find the time complexity of the algorithm. The algorithm says that I have an array of size n and on each element of the array 5 operations are to be performed. So I came up with the following answer that I have to perform 5*n operations in total on it right? so it's time complexity would be of the order n?


回答1:


Yes.

If the time required for each operation is constant.

But also depends on what the operations are.



来源:https://stackoverflow.com/questions/28523398/time-compexity-of-algorithms

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!