exercise7-solved - Algorithms and Data Structures...

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

View Full Document Right Arrow Icon
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 above. The word is parsed from the front to the end until the prefix has more
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 ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern