It is known that there may not exist any stable matching for a given instance of the stable roommates problem. A stable partition is a structure that generalizes the notion of a stable matching; Tan (1991) proved that every instance of the stable roommates problem contains at least one such structure. In this paper we propose a new algorithm for finding a stable partition, and hence a new algorithm for finding a stable matching if one exists. Our algorithm processes the problem dynamically as long as certain relative preference orders are maintained. Some theoretical results about stable partitions are also presented.