Generating Function ¶
~cpp 세로가 3 가로가 n(2의 배수)인 상자가 있다. 여기에 크가가 2*1인 레고를 채울려고 한다. 가로가 n일때 빈칸 없이 가득채울수 있는 모양의 개수를 클로즈폼으로 구하시오.(Generating Function으로 구하시오)
~cpp 원반의 개수가 n인 하노이 타워가 있다(막대는 A, B, C). A막대에 있는 원반을 C로 옴기는데 걸리는 최소횟수를 구하시오(단 A와 B만, B와 C만 이동가능하다. 하노이 타워는 큰 원반이 밑으로만 올수 있는 타워이다.
Generating Function ¶
From Concrete Mathematics, Chapter 7. Generating Function
1. (Warm up) An eccentric collector of 2 x n domino tilings pays $4 for each vertical domino and $1 for each horizontal domino. How many tiling are worth exactly $m by this criterion? For example, when m = 6 there are three solutions.
2. (Warmp up) What is Sigma( Hn / 10^n ) ( n >= 0 )?
3. (Basic)Solve the recurrence
From Discrete mathematics
5. Let us use a generating function to find a formula for s<sub>n</sub>, where s<sub>0</sub> = s<sub>1</sub> = 1, and s<sub>n</sub> = -s<sub>n-1</sub> + 6s<sub>n-2</sub> for n ≥ 2.
6~8 Give a generating fuction for the sequence {a<sub>n</sub>}.
6. Let a<sub>r</sub> be the number of ways to select r balls from 3 red balls, 2 green balls, and 5 white balls.
7. Let a<sub>r</sub> be the number of ways r cents worth of postage can be placed on a letter using only 5c, 12c, and 25c stamps. The positions of the stamps on the letter do not matter.
8. Let a<sub>r</sub> be the number of ways to pay for an item costing r cents with pennies, nickels, and dimes.
G(0) = 1
G(n) = G(n-1) + 2G(n-2) + 3G(n-3) + ... + nG(0), for n > 0
4. (Homework exercises) How many spanning trees are in an n-wheel( a graph with n "outer" verices in a cycle, each connected to an (n+1)st "hub" vertex), when n >= 3?
G(n) = G(n-1) + 2G(n-2) + 3G(n-3) + ... + nG(0), for n > 0
6. Let a<sub>r</sub> be the number of ways to select r balls from 3 red balls, 2 green balls, and 5 white balls.