This paper proposes an efficient algorithm to solve the problem of sorting a list of elements with parent-child relationships that correspond to all the records in the database table. It is assumed that all the records are loaded into memory as a list of elements. |