lecture08

# lecture08 - Great Theoretical Ideas In Computer Science A...

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

9/22/2011 1 Counting III: Catalan numbers, Generating functions Great Theoretical Ideas In Computer Science A. Gupta V. Guruswami CS 15-251 Fall 2011 Lecture 8 September 22, 2011 Carnegie Mellon University 1 (1-X) n = k = 0 X k k+n-1 n-1 m x x x r 2 1 . . Let us recap some key results from last lecture How many integer nonnegative solutions to the following equations? m x x x r 2 1 ... m 1 r m 1 - r 1 - r m The Binomial Formula k n k n 0 k n y x k n y) (x The Multinomial Formula    i k ,, r=n 3k 12 2 1 k n 2 1 r r r r 3 2 1 k r r . ..,r 2 1 k X +X +. ..+ X n = X X X . ..X r ;r ;. ..;r n r 1 ;r 2 ;...;r k 0, if r 1 r 2 ... r k n n! r 1 !r 2 !...r k ! Manhattan walk All the avenues numbered 0 through x , run north-south, and all the streets, numbered 0 through y, run east-west. The number of [sensible] ways to walk from the corner of 0th st. and 0th avenue to the opposite corner of the city equals: 0 x (0,0) (x,y) xy y  

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

View Full Document
9/22/2011 2 level n (n total steps) k’th Avenue 1 1 1 1 1 1 1 1 1 1 1 3 2 3 4 4 6 15 6 6 5 5 10 10 15 20 Manhattan walk and Pascal’s traingle k n 1 1 = # Manhattan walks to this node n-k . . . . . . . . . . . . . . . . . . . . . . . . . level n (n total steps) k’th Avenue 1 1 1 1 1 1 1 1 1 1 1 3 2 3 4 4 6 15 6 6 5 5 10 10 15 20 Pascal’s identity via Manhattan walks 1 - k 1 - n k 1 - n k n 1 1 Level n k th avenue 0 1 2 3 4 n k 2 How many ways to get to via ? Level 2n k th avenue 0 1 2 3 4 2n n n k k = 0 n 2 = End Recap End recap What if we require the Manhattan walk to never cross the diagonal ? How many ways can we walk from (0,0) to (n,n) along the grid subject to this rule? Noncrossing Manhattan walk n n (n,n) (0,0)
9/22/2011 3 14 such walks for n=4 (c.f. total # Manhattan walks = = 70 ) 4 8 Let’s count # violating paths, that do cross the diagonal Will do so by a bijection. Find first step above the diagonal. “Flip” the portion of the path after that step. Flip the portion of the path the first edge above the diagonal. Note: New path goes to (n-1,n+1) Claim (think about it): Every Manhattan walk from (0,0) to (n-1,n+1) can be obtained in this fashion in exactly one way 1 2 2 n n n n Thus, number of noncrossing Manhattan walks on n x n grid = How many sequences of n 0’s and n 1’s are there such that every prefix has more 0’s than 1’s? The above is the n’th Catalan number.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 14

lecture08 - Great Theoretical Ideas In Computer Science A...

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

View Full Document
Ask a homework question - tutors are online