日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Chapter 4, FAQ about Master Theorm, exercises and problems

發布時間:2023/12/20 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Chapter 4, FAQ about Master Theorm, exercises and problems 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
FAQ about the Master theorem
Q1: Why in case 1, f(n) must be polynomially smaller than n^log(b,a)?
Recall the lemma proved in the proof of the master theorem
i.e. for T(n) = a*T(n/b) + f(n)
T(n) = Θ(n^log(b,a)) + sigma(j=0~log(b,n)-1, a^j * f(n/b^j))
So if f(n) is only o(n^log(b,a)) instead of O(n^(log(b,a)-ε)
then T(n) = Θ(n^log(b,a)) + log(b,n) * o(n^log(b,a))
So how can you determine if T(n) = Θ(n^log(b,a)) or Θ(n^log(b,a) * logn) or some functions between these bounds?

Q2: In the regularity condition in case 3, a*f(n/b) <= c*f(n), what if c>=1?
A: If c>=1, you can't decide sigma(j=0~log(b,n)-1, a^j * f(n/b^j)) = O(f(n)).
See the proof in CLRS.

Q3: (Ex 4.4-3) Why the case 3 is overstated? i.e. Prove regularity condition a*f(n/b) <= c*f(n) (c<1) implies f(n) = Ω(n^(log(b,a)+ε))
A: It's easy to conclude that f(n) <= (c/a)^k * f(n*b^k) for any positive integer k
Consider g(n) = n^(log(b,a)+ε), when ε is positive and to be determined
Assume a*f(n/b) <= c*f(n) is correct for all n >= m, when m is a constant
f(m*b^k) >= (a/c)^k * f(m)
g(m*b^k) = (m*b^k)^(log(b,a)+ε) = b^(k*ε) * a^k * g(m) = (a*b^ε)^k * g(m)
Thus, if ε is selected such that a*b^ε <= a/c (it is possible to select a positive ε because a/c > a)
Assume x = m*b^k and k is sufficiently large
g(x) / f(x) = (c*b^ε)^k * (g(m) / f(m))
Since g(m)/f(m) is constant, c*b^ε<1, k is sufficiently large,
g(x) / f(x) -> 0 when k -> +∞
Thus for k is sufficiently large, f(m*b^k) > g(m*b^k) is correct
Using the similar technique in CLRS to eliminate the restriction of exact powers, it can be concluded that f(n) > g(n) is correct for all sufficiently large n

Q4: (Ex 4.3-5) Give an example of a>=1, b>1, f(n) that satisfies all the conditions in case 3 of the master theorem except the regularity condition
T(n) = T(n/2) + n/lgn
n/(2*(lgn-1)) <= c*n/lgn <==> lgn <= 2*c*(lgn-1) <==> 2*c <= (2*c-1)*lgn
Q5: In Rujia Liu's book, the statement of the Master theorem is not exactly that of CLRS'. Which is correct? Or are they equivalent?
A: They're almost equivalent. However, the statement in Liu's book is quite ambiguous since he uses "if a*f(n/b) = f(n) then..." (otherwise, how could it be a "simplified master theorem"?)

Exercises
4.3-5 See FAQ4 above

4.4-3 See FAQ3 above

Problems
4-1 Recurrence examples
Give asymptotic upper and lower bounds for T(n) in each of the following recurrences.
a. T(n) = 2*T(n/2) + n^3
Θ(n^3)
b. T(n) = T(9n/10) + n
Θ(n)
c. T(n) = 16*T(n/4) + n^2
Θ(n^2logn)
d. T(n) = 7*T(n/3) + n^2
Θ(n^2)
e. T(n) = 7*T(n/2) + n^2
Θ(n^lg7), or Θ(n^2.80)
f. T(n) = 2*T(n/4) + sqrt(n)
Θ(sqrt(n)*logn)
g. T(n) = T(n-1) + n
Θ(n^2)
h. T(n) = T(sqrt(n)) + 1
Θ(loglogn)

4-4 More recurrence examples
Give asymptotic upper and lower bounds for T(n) in each of the following recurrences.
a. T(n) = 3*T(n/2) + nlgn
Θ(n^lg3), or Θ(n^1.58)
b. T(n) = 5*T(n/5) + n/lgn
Θ(nloglogn)
Use the recursive tree method to conclude that the result is:
Θ(n*(1/log(5,n) + 1/log(5,n/5) + ...))
=Θ(n*(1/log(5,n) + 1/(log(5,n)-1) + ...))
=Θ(n*H(log(5,n)) (H(n) = 1+1/2+...+1/n)
=Θ(nloglogn)

c. T(n) = 4*T(n/2) + n^2*sqrt(n)
Θ(n^2*sqrt(n)) or Θ(n^2.5)
d. T(n) = 3*T(n/3 + 5) + n/2
Θ(nlogn)
Let a[n] denote for the problem size of n-th level in the recursive tree
Let b[n] = a[n]/3 - 15/2, then b[n] = b[n-1]/3
Thus the depth of the tree is Θ(logn)
So T(n) = Θ(nlogn)

e. T(n) = 2*T(n/2) + n/lgn
Θ(nloglogn)
f. T(n) = T(n/2) + T(n/4) + T(n/8) + n
Θ(n)
Also use recursive tree method, but force each level to be T(n/2^k). This means an addition may happen between lines.
Pay special attention to how many n/2^k calculated in each level. It can be concluded that the quantity also satisfies a[n] = a[n-1]+a[n-2]+a[n-3] recurrence. Just solve the recurrence, and then the?complexity of the final level?Θ(n^lg(1.83)) can be concluded. Here 1.83 is the approximate root of x^3 - x^2 - x - 1 = 0. Thus the overall complexity is Θ(n)

g. T(n) = T(n-1) + 1/n
Θ(logn)
h. T(n) = T(n-1) + lgn
Θ(nlogn)
i. T(n) = T(n-2) + 2lgn
Θ(nlogn)
j. T(n) = sqrt(n)*T(sqrt(n)) + n
Θ(nloglogn)

4-6 VLSI chip testing
Professor Diogenes has n supposedly identical VLSI chips that in principle are capable of testing each other. A good chip always reports accurately whether the other chip is good or bad, but the answer of a bad chip cannot be trusted. Thus the four possible outcomes of a test are as follows:
Chip A says Chip B says Conclusion
------------------------------------
B is good A is good both are good or both are bad
other cases... at least one is bad

a. Show that if more than n/2 chips are bad, the professor cannot necessarily determine which chips are good using any strategy based on this kind of pairwise test. Assume that the bad chips can conspire to fool the professor.
If more than n/2 chips are bad, then there are fewer than n/2 good chips. Good chips can reflect true states, that is, returning "good" for good chips and "bad for bad chips.
Let's divide all chips into three groups, m good chips(Group A), m bad chips(Group B), and n-2m bad chips(Group C). If test results are as below:
ABC
A:GBB
B:BGB
C:BBB
Then Group A and Group B behave identically. Thus we can know one of the two groups is made of good chips, but we can't determine which group is.

b. Consider the problem of finding a single good chip from among n chips, assuming that more than n/2 of the chips are good. Show that floor(n/2) pairwise tests are sufficient to reduce the problem to one of nearly half the size.
Split [n/2]*2 chips into [n/2] pairs of chips
If the test result is "good" for both chips, it can be determined that the two chips are of the same state, both good or both bad. So we just need to find the state of one chip, and the other's state is determined.
If there's "bad" result for either chip, just discard them temporarily. When the final result is determined, that is, good chips are determined, we can just use these good chips to determine the chips that we discarded.
Thus the problem is of almost half the size.

c. Show that the good chips can be identified with Θ(n) pairwise tests, assuming that more than n/2 of the chips are good. Give and solve the recurrence that describes the number of tests.
T(n) = T(n/2) + Θ(n)
Thus T(n) = Θ(n)

轉載于:https://www.cnblogs.com/FancyMouse/articles/1033855.html

總結

以上是生活随笔為你收集整理的Chapter 4, FAQ about Master Theorm, exercises and problems的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 欧美一级成人 | 蜜桃av噜噜一区二区三区 | 潘金莲一级淫片a.aaaaa播放 | 亚洲第8页 | 一区二区三区在线观看av | 色一情| av午夜影院 | 亚洲精品性视频 | 中文字幕在线观看欧美 | 一级看片免费视频 | 国产麻豆一区二区 | 免费超爽大片黄 | 99国产精品一区 | 亚洲精品电影在线 | 亚洲美女免费视频 | 色吧在线观看 | 日韩欧美一区在线 | 亚洲av无码片一区二区三区 | 欧美大尺度床戏做爰 | 色婷婷av一区 | 综合久久91 | 吖v在线| 国产午夜一区二区三区 | 免费操片 | 日韩国产欧美综合 | 亚洲一级片在线播放 | 日本成人网址 | 日韩精品在线观看一区 | 国模无码视频一区 | 毛片在线免费观看视频 | 成人精品视频网站 | 免费黄色网页 | 男人影院在线 | 美国黄色一级毛片 | 国产成人三级在线观看视频 | 怡春院一区二区 | 视频h在线 | 日韩国产电影 | avtt久久| sm在线观看 | 桃色一区 | 一起艹在线观看 | 久久伊人操 | 亚洲砖区免费 | 欧美一级在线免费 | 91免费版黄色 | 插女生下面 | 少妇高潮喷水在线观看 | 扒开女人屁股进去 | 日韩专区视频 | 国产精品中文久久久久久 | 少妇系列av| 欧美一区,二区 | av网站在线免费看 | 色哟哟在线 | 自拍天堂 | 激情网综合 | 天天操天天干天天操 | 亚洲专区欧美专区 | 大奶子在线 | 日韩中文字幕有码 | 精品午夜一区二区 | 在线日韩精品视频 | 欧美一级特黄aaaaaa大片在线观看 | 起碰在线 | 毛片日本| 999久久久精品 | 黄色小视频在线观看免费 | 色综合图片区 | 插吧插吧综合网 | 另类专区欧美 | av香港经典三级级 在线 | 一区二区高清在线观看 | 99er在线观看| 欧美操操操 | 久久av无码精品人妻系列试探 | 在线观看亚洲精品 | 波多野结衣91 | 少妇一区二区视频 | 日韩人妻无码一区二区三区 | 亚洲最大的成人网站 | 一区二区三区日本视频 | 花样视频污| 成年人av在线播放 | 九九综合九九综合 | 亚洲一区a| jzzijzzij亚洲成熟少妇在线观看 久久久精品人妻一区二区三区 | 国产精品亚洲一区二区无码 | 亚洲色图欧美在线 | 少妇无套高潮一二三区 | 日韩精品一区在线播放 | 黄色图片小说 | 91精品国产一区 | 亚洲AV无码一区二区三区蜜桃 | 久久久久久久久久久91 | a黄色片| 国产精品爽爽久久久久久 | 精品久久99| 草莓视频在线观看入口w |