摘要 |
A compact representation of a tree data structure and techniques for navigating the compact representation. The compact representation is a list (302). Each element (304) of the list represents a node of the tree and the list is organized according to a preorder traversal of the tree. Each list element contains only the index (303) of a data dictionary (305) entry for the kind of item represented by the node corresponding to the list element. The navigation techniques permit the location of the list element for the sibling of the node corresponding to the given list element, the location of the list element for that node's parent, and in the case of a parent node, the location of the list element for any child of the parent. The navigation techniques work by finding the list elements for subtrees. The subtrees are found by techniques based on the fact that the number of children of all of the nodes in a subtree minus the number of nodes in the subtree always equals -1. The number of children of a given node is determined by a valence function (313) which takes the index of the data dictionary entry as its argument. <IMAGE> |