This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Data Structures and Algorithms (I) close-book final exam Jan 18, 2008 You may answer the questions in any order. Dishonest behaviors and attempts will be punished most seriously. When you are asked to justify, prove, or disprove your answers, you may directly use anything that we have shown in class in a “black-box” manner. Problem 1 (20 points) Draw the resulting red-black tree (10 points) and 2-3-4 tree (10 points) obtained by applying the following operations in order. Let d i be the i-th digit of your student ID number from right to left. An English character is regarded as a digit. For example, if your ID number is B95902031, then d 1 = 1 , d 2 = 3 , d 3 = 0 , and d 9 = 0 . • insert 10 * d 1 + 1 , 11 * d 2 , d 2 3 , 40 + d 4 , 50 + d 5 . • insert 3, 7, 9, 27, 23, 69, 47, 38. • delete 3, 69, 27, d 2 3 . • insert 69, d 2 3 . For the part of red-black tree, you do not have to draw the dummy leaves, However, you have to specify the color of each node. No need to show the intermediate steps. Only the final drawings count. An instruction to insert an existing number, if any, has to be ignored.count....
View Full Document