Find the general term of the sequence defined by $a_{0}=a_{1}=0, a_{n+2}=6 a_{n+1}-9 a_{n}+2^{n}+n$.
Without generating function: Let $b_{n}=a_{n}+B 2^{n}+C n+D$. We have

$$
\begin{aligned}
b_{n+2}= & a_{n+2}+B 2^{n+2}+C(n+2)+D \\
= & 6 a_{n+1}-9 a_{n}+2^{n}+n+B 2^{n+2}+C(n+2)+D \\
= & 6\left(b_{n+1}-B 2^{n+1}-C(n+1)-D\right)-9\left(b_{n}-B 2^{n}-C n-D\right) \\
& +2^{n}+n+B 2^{n+2}+C(n+2)+D \\
= & 6 b_{n+1}-9 b_{n}+(1+B) 2^{n}+(1+4 C) n+4(D-C)
\end{aligned}
$$

To make $b_{n}$ a linear recurrence, we will take $B=-1, C=D=-\frac{1}{4}$, which gives $b_{0}=-\frac{5}{4}, b_{1}=-\frac{5}{2}$ and then $b_{n+2}-6 b_{n+1}+9 b_{n}=0$ and the problem becomes routine.

With generating function: Let $A$ be the generating function of $a_{n}$. We have

$$
\begin{aligned}
A & =\sum a_{n} X^{n}=X^{2} \sum a_{n+2} X^{n}=X^{2} \sum\left(6 a_{n+1}-9 a_{n}+2^{n}+n\right) X^{n} \\
& =6 X \sum a_{n} X^{n}-9 X^{2} \sum a_{n} X^{n}+X^{2} \sum(2 X)^{n}+X^{2} \sum(n+1) X^{n}-X^{2} \sum X^{n} \\
& =6 X A-9 X^{2} A+\frac{X^{2}}{1-2 X}+\frac{X^{2}}{(1-X)^{2}}-\frac{X^{2}}{1-X}
\end{aligned}
$$

So

$$
A=\frac{\frac{X^{2}}{1-2 X}+\frac{X^{2}}{(1-X)^{2}}-\frac{X^{2}}{1-X}}{1-6 X+9 X^{2}}=\frac{1}{4} \frac{1}{(1-X)^{2}}+\frac{1}{1-2 X}-\frac{5}{3} \frac{1}{1-3 X}+\frac{5}{12} \frac{1}{(1-3 X)^{2}}
$$

So the answer is $\frac{1}{4}(n+1)+2^{n}-\frac{5}{3} 3^{n}+\frac{5}{12}(n+1) 3^{n}=\frac{n+1}{4}+2^{n}+\left(-\frac{5}{4} n+\frac{5}{12}\right) 3^{n}$.