我是正常蛇

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2012年8月29日

摘要: http://www.php100.com/html/itnews/PHPxinwen/2012/0823/10937.html用单引号代替双引号来包含字符串,这样做会更快一些。因为PHP会在双引号包围的字符串中搜寻变量,单引号则不会,注意:只有echo能这么做,它是一种可以把多个字符串当作参数的“函数”(译注:PHP手册中说echo是语言结构,不是真正的函数,故把函数加上了双引号)。1、如果能将类的方法定义成static,就尽量定义成static,它的速度会提升将近4倍。2、$row[’id’] 的速度是$row[id]的7倍。3、echo 比 print 快,并且使用echo的多重参数(译 阅读全文
posted @ 2012-08-29 18:08 我是正常蛇 阅读(106) 评论(0) 推荐(0) 编辑

摘要: AlgorithmRunning time:A algorithm's running time depends on a lot of things,such as:Input itself.If the input is already sorted,then the algorithm may have very little work to do.Size of the input.Some algorithms are better at sorting small data while some others are better at large data.Normall 阅读全文
posted @ 2012-08-29 17:59 我是正常蛇 阅读(388) 评论(0) 推荐(0) 编辑

摘要: O:f(n) = O(g(n)) , means that there are some suitable constants,such that 0 <= f(n) <= c·g(n). Consider as less than or equal to.Ex:f(n) = n3 +O(n2) , means that f(n) is basically n3but there are these lower order terms that are O(n2).n2 + O(n) =O(n2)Ω:f(n) =Ω(g(n)) , means that f(n) is a 阅读全文
posted @ 2012-08-29 17:58 我是正常蛇 阅读(199) 评论(0) 推荐(0) 编辑