08.10.2016 Views

Foundations of Data Science

2dLYwbK

2dLYwbK

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

need to argue that no other sequence can give rise to the same tree. Suppose some other<br />

sequence did. Then the i th integer in the sequence must be j. By the induction hypothesis<br />

the sequence with j removed is unique.<br />

Algorithm<br />

Create leaf list - the list <strong>of</strong> labels not appearing in the Prüfer sequence. n is the<br />

length <strong>of</strong> the Prüfer list plus two.<br />

while Prüfer sequence is non empty do<br />

begin<br />

p =first integer in Prüfer sequence<br />

e =smallest label in leaf list<br />

Add edge (p, e)<br />

Delete e from leaf list<br />

Delete p from Prüfer sequence<br />

If p no longer appears in Prüfer sequence add p to leaf list<br />

end<br />

There are two vertices e and f on leaf list, add edge (e, f)<br />

12.10 Exercises<br />

Exercise 12.1 What is the difference between saying f(n) is O (n 3 ) and f(n) is o (n 3 )?<br />

Exercise 12.2 If f (n) ∼ g (n) what can we say about f(n) + g(n) and f(n) − g(n)?<br />

Exercise 12.3 What is the difference between ∼ and Θ?<br />

Exercise 12.4 If f (n) is O (g (n)) does this imply that g (n) is Ω (f (n))?<br />

(<br />

Exercise 12.5 What is lim k−1 k−2.<br />

k→∞<br />

k−2)<br />

Exercise 12.6 Select a, b, and c uniformly at random from [0, 1]. The probability that<br />

b < a is 1 / 2 . The probability that c><br />

mean. Can we have median

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!