Changeset 56 for trunk/src/helpers/tree.c
- Timestamp:
- Apr 8, 2001, 9:17:16 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/tree.c
r55 r56 24 24 * a tree-like structure. 25 25 * 26 * For this, the functions here use the TREE structure. You can 27 * easily see that this has the "left" and "right" members, 28 * which make up the tree. 29 * 30 * In addition, each tree has a "tree root" item, from which all 31 * other tree nodes can be reached by following the "left" and 32 * "right" pointers. 26 * While lists have "next" and "previous" pointers, trees have 27 * "left" and "right" pointers which keep the tree sorted at 28 * all times. 33 29 * 34 30 * Per definition, in our trees, if you follow the "left" pointer, … … 36 32 * Reversely, following the "right" pointer will lead you to a 37 33 * node which is "less than" the current node. 34 * 35 * What is considered "less" or "greater" is determined by a 36 * comparison callback to be supplied by the caller. 37 * 38 * For this, the functions here use the TREE structure. You can 39 * easily see that this has the "left" and "right" members, 40 * which make up the tree. 41 * 42 * In addition, each tree has a "tree root" item, from which all 43 * other tree nodes can be reached by following the "left" and 44 * "right" pointers. 38 45 * 39 46 * The implementation here has the following characteristics: … … 66 73 * that the first member in the structure is a TREE structure 67 74 * (i.e. it has the left, right, parent, id, and colour members). 68 * The tree functions don't care what follows. 75 * The tree functions don't care what follows, since they do 76 * not manage any memory themselves. 69 77 * 70 78 * So the implementation here is slightly different from the … … 106 114 * the TREE structure instead. If this flavor is used, an 107 115 * internal comparison function is used for comparing the 108 * "id" fields, which are plain ULONGs.116 * "id" fields, which are assumed to be plain ULONGs. 109 117 * 110 118 * <B>Trees vs. linked lists</B> … … 139 147 * -- As opposed to a LISTNODE, the TREE structure (which 140 148 * represents a tree node) does not contain a data pointer, 141 * as said above. 149 * as said above. The caller must do all memory management. 142 150 * 143 151 *@@added V0.9.5 (2000-09-29) [umoeller] … … 245 253 + 246 254 + treeInsertID(&TreeRoot, 247 + (TREE*)pTreeItem,248 + FALSE);255 + (TREE*)pTreeItem, 256 + FALSE); 249 257 * 250 258 * Returns: … … 699 707 unsigned long id) 700 708 { 701 TREE 702 *current = *root, 703 *found = NULL; 709 TREE *current = *root, 710 *found = NULL; 704 711 705 712 while (current != TREE_NULL) … … 725 732 unsigned long idFind) 726 733 { 727 TREE 728 *current = *root, 729 *found; 734 TREE *current = *root, 735 *found; 730 736 731 737 found = NULL; … … 752 758 FNTREE_COMPARE_NODES *comp) 753 759 { 754 TREE 755 *current = *root, 756 *found; 760 TREE *current = *root, 761 *found; 757 762 758 763 found = NULL; … … 780 785 FNTREE_COMPARE_NODES *comp) 781 786 { 782 TREE 783 *current = *root, 784 *found; 787 TREE *current = *root, 788 *found; 785 789 786 790 found = NULL; … … 807 811 FNTREE_COMPARE_NODES *comp) 808 812 { 809 TREE 810 *current = *root, 811 *found; 813 TREE *current = *root, 814 *found; 812 815 813 816 found = NULL; … … 834 837 FNTREE_COMPARE_NODES *comp) 835 838 { 836 TREE 837 *current = *root, 838 *found; 839 TREE *current = *root, 840 *found; 839 841 840 842 found = NULL; … … 861 863 FNTREE_COMPARE_NODES *comp) 862 864 { 863 TREE 864 *current = *root, 865 *found; 865 TREE *current = *root, 866 *found; 866 867 867 868 found = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.