# Exam1-Sol - Computer Science II(COP 3503 Honors Exam#1...

This preview shows pages 1–5. Sign up to view the full content.

Computer Science II (COP 3503) Honors Exam #1 Solutions Fall 2009 September 25, 2009 Lecturer: Arup Guha

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

View Full Document
1) (8 pts) Show the result of inserting the value 60 into the following 2-4 Tree: 8, 16, 40 / | | \ 3 14 32 43, 49, 57 Initially, insert the 60, causing an overflow that pushes the 57 up to its parent. This causes another overflow, pushing the 40 up to a newly created level. Here is the answer: 40 / \ 8 , 16 57 / | \ / \ 3 14 32 43,49 60 2) (10 pts) Show the result of deleting the value 10 from the AVL Tree shown below: 40 / \ 20 60 / \ / \ 10 30 50 70 / / \ \ 25 45 55 80 / 52 First, a rotation occurs at the 20, making 25 the child of 40 with 20 and 30 as its children. Next, there is an imbalance at 40. Tracing the longest path down, we find A = 40, C = 60 and B = 50. The resulting answer is 50 / \ 40 60 / \ / \ 25 45 55 70 / \ / \ 20 30 52 80
3) (25 pts) What is the value of the following infinite sum, in terms of x? (Note: assume that |x| < 1.) Let S = Then xS = Subtracting, we get S – xS = S – xS = S – xS = S(1 – x) = So, S =

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

View Full Document
4) (25 pts) Complete the implementation of the Disjoint Set class shown below. Note: No
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

Exam1-Sol - Computer Science II(COP 3503 Honors Exam#1...

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

View Full Document
Ask a homework question - tutors are online