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: Algorithms and Data Structures Assignment 7 - Solution Flavia Grosan, Vladislav Perelman, Dr. Andreas N¨uchter Fall 2009 Exercise 7.1 In exercise 6.4 you had to show, that three sets have the same cardinality. Show that the cardinality is 2 n n- 2 n n- 1 Hint: Remember the meaning of the binomial coefficient . Solution There are 2 n n possibilities to place n open brackets in 2n positions. Consequently, the position of the closing brackets is clear. Of the 2 n n terms generated this way, the ones that to do not meet the prefix requirement have to be removed. Consider w = w 1 ...w n be such a word. Let w 1 ...w i be the shortest prefix, which does not meet the required property. Only in this example the open brackets are replaced by closing one. Attention: the original prefix contains one closing bracket more than opening ones. After the previous step, w has n+1 open brackets and n-1 closing brackets. Conversely, every such word w ’ can be mapped to a word obtained by reversing the process...
View Full Document