php常用命令
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了php常用命令,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1896字,纯文字阅读大概需要3分钟。
内容图文
Once an algorithm is given for a problem and decided to be correct, an important step is to determine how much in the way of resources,such as time or space, the algorithm will require.
The important things to know are:
1)It‘s very bad style to include constants or low-order terms inside a Big-Oh
2)This means that in any analysis that ignore lower-order terms and constants.
Example: Do not say T(N) = O(2N^2) or T(N) = O(N^2 + N);
The correct form is T(N) = O(N^2).
General Rules:
Rule1: for loop:
The running time of a for loop is at most the running time of the statements inside the for loop(including tests) times the number of iterations.
As an example, the following program fragment is O(N):
for(i=0; i<N; i++) k++;Rule2:Nested for loop:
Analyze these inside out. The total running time of a statement inside a group of nested loops is the running time of the statement multiplied by the product of the sizes of all the for loops.
As an example, the following program fragment is O(N^2):
for(i=0; i<N; i++) for(j=0; j<N; j++) k++;Rule3:Consecutive Statements:
These just add(which means that the maximum is the one that counts).
As an example, the following program fragment, which has O(N) work followed by O(N^2) work, is also O(N^2):
for(i=0; i<N; i++) A[i] = 0; for(i=0; i<N; i++) for(j=0; j<N; j++) A[i] += A[j]+i+j;
Rule4:if/else:
For the fragment
if(Condition)
S1
else
S2
The running time of an if/else statement is never more than the running time of the test plus the larger of the running times of S1 and S2.
Notices:
A basic strategy of analyzing from the inside(or deepest part) our works.
If there are function calls, these must be analyzed first.
Reference:
Data Structures and Algorithm Analysis in C .Second Edtion
Than you for reading!
--By lzq at NanYang May.26.2014
原文:http://blog.csdn.net/angel22xu/article/details/27102713
内容总结
以上是互联网集市为您收集整理的php常用命令全部内容,希望文章能够帮你解决php常用命令所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。