{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

c109s00t2 - CSc 109 Test 2 26 April 2000 >ANSWERS< 1(10 pts...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSc 109 Test 2 26 April 2000 >>>>>>>>>>>>>>>>>>>>>>>>>>ANSWERS<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 1. (10 pts) Assume the algorithm discussed in class for balancing a binary tree is used to maintain the two balanced trees below so that an in order traversal of the tree lists the data in ascending order. Explain why both tree (a) and tree (b) are balanced. Draw tree (a) after 15 has been added to tree (a) with balance maintained. Draw tree (b) after 13 has been added to tree (b) with balance maintained. Draw tree (b) after 28 (instead of 13) has been added to tree (b) with balance maintained. Draw tree (b) after 19 (instead of 13 or 28) has been added to tree (b) with balance maintained. (a) 20 / 12 15 / \ 12 20 (b) 15 15 / \ 13 / \ 12 20 ----> 12 20 / / \ / \ / \ 10 17 25 10 13 17 25 / \ / \ / \ / \ 16 18 23 30 16 18 23 30 15 20 / \ 28 / \ 12 20 -----> 15 25 / / \ / \ / \ 10 17 25 12 17 23 30 / \ / \ / / \ / 16 18 23 30 10 16 18 28 15 17 / \ 19 / \ 12 20 ----> 15 20 / / \ / \ / \ 10 17 25 12 16 18 25 / \ / \ / \ / \ 16 18 23 30 10 19 23 30 2. (10 pts) Write the following expressions in postfix form, assuming
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 4

c109s00t2 - CSc 109 Test 2 26 April 2000 >ANSWERS< 1(10 pts...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online