12.07.2015 Views

Problem Set 4 Solutions

Problem Set 4 Solutions

Problem Set 4 Solutions

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Handout 18: <strong>Problem</strong> <strong>Set</strong> 4 <strong>Solutions</strong>3G: 4 G: 4B: 7H: 5C: 25B: 7H: 5A: 10 E: 23 K: 65A: 10 E: 23K: 65I: 73C: 25I: 73(a)(b)G: 4G: 4D: 9B: 7H: 5B: 7H: 5A: 10 E: 23K: 65A: 10 E: 23K: 65C: 25I:73D: 9I:73D: 9 C: 25(c)(d)G: 4F: 2B: 7H: 5F: 2. . .B: 7G: 4A: 10D: 9K: 65A: 10D: 9H: 5C: 25E: 23I:73C: 25E: 23 K: 65I:73(e)(f)Figure 2: Operation of TREAP-INSERT. As in Figure 1, each node x is labeled with key[x] :priority[x]. (a) Original treap prior to insertion. (b) The treap after inserting a node with keyC and priority 25. (c)–(d) Intermediate stages when inserting a node with key D and priority 9.(e) The treap after insertion of parts (c) and (d) is done. (f) The treap after inserting a node withkey F and priority 2.

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

Saved successfully!

Ooh no, something went wrong!