AN EFFICIENT ALGORITHM FOR CONVERTING A SPREADSHEET OF ROWS WITH IMPLICIT PARENT-CHILD RELATIONSHIPS TO A DATABASE TABLE OF ROWS WITH EXPLICIT PARENT-CHILD RELATIONSHIPS
Abstract
Converting difficult-to-use data to easy-to-use one in real world applications is popular. This paper proposes an efficient algorithm for converting data from an input spreadsheet of rows with implicit parent-child relationships to a database table of rows with explicit parent-child relationships and defined birth orders. Here, a row with an implicit parent-child relationship has no reference fields to its parent row, but its parent can be determined by its level and order. The input spreadsheet is hard to query and bind with tree type user interface components for display in applications, while the output database table is convenient. The proposed algorithm’s time complexity is O(n), where n is the number of rows in the input spreadsheet. The algorithm also uses limited memory space: it uses a few basic data type variables and two integer lists, where their size doesn’t exceed the number of different levels used to assign to the spreadsheet’s rows.