23.11.2014 Views

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

SHOW MORE
SHOW LESS

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

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

Are the rotations <strong>in</strong> Figures 10.8 <strong>and</strong> 10.10 s<strong>in</strong>gle or double rotations?<br />

R-10.9<br />

Draw the AVL tree result<strong>in</strong>g from the <strong>in</strong>sertion of an entry with key 52 <strong>in</strong>to the<br />

AVL tree of Figure 10.10b.<br />

R-10.10<br />

Draw the AVL tree result<strong>in</strong>g from the removal of the entry with key 62 from the<br />

AVL tree of Figure 10.10b.<br />

R-10.11<br />

Expla<strong>in</strong> why perform<strong>in</strong>g a rotation <strong>in</strong> an n-node b<strong>in</strong>ary tree represented us<strong>in</strong>g an<br />

array list takes Ω(n) time.<br />

R-10.12<br />

Is the search tree of Figure 10.19a a (2,4) tree? Why or why not?<br />

R-10.13<br />

An alternative way of perform<strong>in</strong>g a split at a node v <strong>in</strong> a (2,4) tree is to partition<br />

v <strong>in</strong>to v ′ <strong>and</strong> v ′′, with v ′ be<strong>in</strong>g a 2-node <strong>and</strong> v ′′ a 3-node. Which of the keys k 1 ,<br />

k 2 , k 3 , or k 4 do we store at v's parent <strong>in</strong> this case? Why?<br />

R-10.14<br />

Dr. Amongus claims that a (2,4) tree stor<strong>in</strong>g a set of entries will always have the<br />

same structure, regardless of the order <strong>in</strong> which the entries are <strong>in</strong>serted. Show<br />

that he is wrong.<br />

R-10.15<br />

Draw four different red-black trees that correspond to the same (2,4) tree.<br />

R-10.16<br />

Consider the set of keys K = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}.<br />

a.<br />

Draw a (2,4) tree stor<strong>in</strong>g K as its keys us<strong>in</strong>g the fewest number of nodes.<br />

b.<br />

Draw a (2,4) tree stor<strong>in</strong>g K as its keys us<strong>in</strong>g the maximum number of nodes.<br />

667

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

Saved successfully!

Ooh no, something went wrong!