  A general classification of linear differential and finite-difference
operators possessing a finite-dimensional invariant subspace with a polynomial
basis (the generalized Bochner problem) is given. The main result is that any
operator with the above property must have a representation as a polynomial
element of the universal enveloping algebra of some algebra of differential
(difference) operators in finite-dimensional representation plus an operator
annihilating the finite-dimensional invariant subspace. In low dimensions a
classification is given by algebras $sl_2({\bold R})$ (for differential
operators in ${\bold R}$) and $sl_2({\bold R})_q$ (for finite-difference
operators in ${\bold R}$), $osp(2,2)$ (operators in one real and one Grassmann
variable, or equivalently, $2 \times 2$ matrix operators in ${\bold R}$),
$sl_3({\bold R})$, $sl_2({\bold R}) \oplus sl_2({\bold R})$ and $gl_2 ({\bold
R}) \ltimes {\bold R}^{r+1}\ , r$ a natural number (operators in ${\bold
R^2}$). A classification of linear operators possessing infinitely many
finite-dimensional invariant subspaces with a basis in polynomials is
presented. A connection to the recently-discovered quasi-exactly-solvable
spectral problems is discussed.
