Skip to Main Content
In this paper, an efficient tree generation algorithm based on prefix code is proposed. The algorithm utilizes the sequence consistency of the database record set and the preorder traversal tree. It only need to query on the database and traversal the tree nodes one time respectively, then all nodes can be added to the tree one by one. There is only one cycle that is the traverse of the tree nodes collection, so the time complexity of the algorithm is O (n). Experimental results show that the tree nodes and their child nodes can be queried and stated rapidly.