  Recently, we have introduced and studied the topic of sub-indices and
sub-factors of groups. During those studies, an algorithm for obtaining the
sub-factors of a finite group was stated and proved, which has a particular
case for calculating the transversals of subgroups.
  In this work, we first show that it is a complete algorithm for obtaining all
transversals. Then, motivated by it,
  we state and prove a complete general algorithm to obtain all representatives
  and the number of double cosets of subgroups (which has not been possible so
far).
  Moreover, we introduce the concept of middle direct product of three subsets
and several
  equivalent conditions for a subset to be a complete set of representatives
  of double cosets. Also, as another important result of the topic, we provide
a definitive method
  to obtain the middle factor of groups relative to a couple of subgroups.
