-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathchapter_0.txt
29 lines (22 loc) · 934 Bytes
/
chapter_0.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
1.a. f = o(g)
b. f = o(g)
c. f = o(g)
d. f = o(g)
e. f = o(g)
f. f = o(g)
2.
a. O(n)
b. O(n^2)
c. O(2**n)
d. O(logn)
e. O(n)
f. O(n*logn)
g. 3**log(n) -> n**log(3)
h. I get O(n^2*logn), but the solution says O(n^2). Why? Expanding it out, you get e.g.:
8*f(n/8) + 4*O((n/4)**2) + 2*O((n/2)**2) + O(n**2)
-> 8*f(n/8) + O(n**2) + O(n**2) + O(n**2)
collecting, -> O(n**log2) + logn*O(n**2)
-> O(n**2*logn). Going to ask around.
Update: the O(n^2)s are all "the same", I guess. Can rewrite
as C * n^2 for some sufficiently large C.
3. The last one rotates at 212/50^12 rotations per minute. That's 10^-19 rotations per minute. Assuming a radius of 3", a point on the outside moves 6pi inches per rotation. that's 6pi* 10^-19 inches per minute. That's 10*-11 millimeters per year. So maybe 100 years to move an atom's distance? And it would take more than that to break apart.