Two criteria for a tree to have an f-factor and (g,f)-factors are presented, respectively. They simplify, respectively, Tutte's condition for a graph to have f-factors and Lovász's condition for a graph to have (g,f)-factors. An O(|V(T)|) algorithm and an O(|V(T)|2) algorithm for f-factor and (g,f)-factor problems for trees are given, respectively.