渐近上限O(1)该怎么算?
c++吧
全部回复
仅看楼主
level 11
endrollex 楼主
数学烂,看算法导论很吃力
0(1) = O(n^0),
书里没说0(1)到底等于什么,wiki说是常数,有网站说是欧拉常数
拿了雇佣问题算下似乎对
O(1)是不是任何情况下永远等于欧拉常数?
我数学大概高二水平,应该看哪些书补充相关知识?[汗]
2012年12月11日 14点12分 1
level 12
[打酱油]
2012年12月11日 14点12分 2
我只想说你这签名是啥图呀?渲染慢死了,经过这里就卡到爆啊!!!!
2012年12月11日 18点12分
只有Chrome有这bug — 来自 Windows Phone 客户端
2012年12月11日 22点12分
level 9
解决一个问题的方法,不随着问题规模的增大而增大,它就是O(1)
2012年12月11日 15点12分 3
也就是常数阶啊
2012年12月12日 01点12分
level 15
任意常数。
2012年12月11日 15点12分 5
[礼物]
2012年12月11日 15点12分
回复 RichSelian :[鼓掌]
2012年12月11日 15点12分
回复 RichSelian : [礼物] [礼物]
2012年12月11日 16点12分
好吧,>0。
2012年12月11日 16点12分
level 12

DEFINITION T(N) = O(
f(N)) if there are positive constants c and n0 such that T(N) <=
c f(N) when N >= n0.
=>
DEFINITION T(N) = O(
1) if there are positive constants c and n0 such that T(N) <=
c when N >= n0.
2012年12月11日 16点12分 7
level 6
其实别被等号误导,这不算f(n)=O(h(n))其实不是一个等式,可以这么解释,O(h(n))表示的是一个**,而f(n)是这个**的一个元素
2012年12月11日 16点12分 8
**(这也屏蔽?)[拍砖]
2012年12月11日 16点12分
算导说的很清楚, 就是指属于, 这里abuse了一下等号
2012年12月11日 17点12分
set必须屏蔽..
2012年12月11日 18点12分
是啊,没微积分基础,被误导了
2012年12月12日 07点12分
level 11
至少我这种看个开头就扔的家伙也知道 书上是有解释的
2012年12月11日 16点12分 9
level 12
说的很清楚吧, 就是指O(n^0).
n为输入数据大小, 跟O(n^2)里的一样.
2012年12月11日 17点12分 10
但奇怪雇佣问题里不管输入多少应聘者,O(n^0)都是0.577215...
2012年12月12日 02点12分
level 12
根据定义的话, 嗯, 耗子说的很清楚了..
话说我也看到这, 但是习题不会做了(于是卡在这了)..
2012年12月11日 17点12分 11
level 5
n的零次方不就是1么。比如我的代码是对比一个数据,这个时候就把它的复杂度看作’1’,之后要对比n个数据,复杂度就是’n’咯,代码里的表现就是多了个关于n的for循环,
2012年12月12日 00点12分 12
level 11
endrollex 楼主
麻省的PDF里他说O(1)是欧拉常数,我也没看懂,大概每个情况都不一样[瀑布汗~]
不知道是不是每个O(1)都能像这样算出?
2012年12月12日 02点12分 13
乖乖,我中文的都看不懂,你真牛,看英文的
2012年12月12日 03点12分
...能不能看下7L? 算导翻到3.1节: O-notation有定义..
2012年12月12日 05点12分
level 13
楼主,加个好友,我也在看,相当吃力!
2012年12月12日 03点12分 14
加你了,英文查字典的
2012年12月12日 03点12分
level 12
For a given function g(n), we denote by O(g(n)) (pronounced “big-oh of g of n” or sometimes just “oh of g of n”) the set of functions
O(g(n)) = {f(n) : there exist positive constants c and n0 such that 0 <= f(n) <= cg(n) for all n > n0} .
-- Introduction to Algorithms, p.47
Since any constant is a degree-0 polynomial, we can express any constant function as Theta(n0), or Theta(1). This latter notation is a minor abuse, however, because the expression does not indicate what variable is tending to infinity.2 We shall often use the notation Theta(1) to mean either a constant or a constant function with respect to some variable.
-- p.46
2012年12月12日 05点12分 15
看了下书,渐进的作用是略去等式无关紧要的细节,看来要算具体值得还原出整个等式。。。雇佣问题应该是个特例,计算期望值的时候把多项式E[X]=H_n完整表示了
2012年12月12日 07点12分
回复 endrollex : [汗]先把前面的内容看完吧. 2.2节(第三版)有一个详细的例子(关于Insertion sort).
2012年12月12日 07点12分
1