Annotation of libwww/Library/src/HTBTree.html, revision 2.16

2.8       frystyk     1: <HTML>
                      2: <HEAD>
2.16    ! frystyk     3: <TITLE>W3C Reference Library libwww Balanced Binary Tree</TITLE>
2.15      frystyk     4: <!-- Changed by: Henrik Frystyk Nielsen, 11-Nov-1995 -->
2.8       frystyk     5: </HEAD>
2.7       timbl       6: <BODY>
2.10      frystyk     7: 
2.8       frystyk     8: <H1>Balanced Binary Tree</H1>
                      9: 
                     10: <PRE>
                     11: /*
2.12      frystyk    12: **     (c) COPYRIGHT MIT 1995.
2.8       frystyk    13: **     Please first read the full copyright statement in the file COPYRIGH.
                     14: */
                     15: </PRE>
                     16: 
                     17: Tree creation, traversal and freeing. User-supplied comparison
                     18: routine.<P>
                     19: 
                     20: This module is implemented by <A HREF="HTBTree.c">HTBTree.c</A>, and
2.15      frystyk    21: it is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C
                     22: Reference Library</A>.
2.8       frystyk    23: 
                     24: <PRE>
2.10      frystyk    25: #ifndef HTBTTEE_H
                     26: #define HTBTREE_H
1.1       timbl      27: 
2.15      frystyk    28: #include "HTArray.h"
2.10      frystyk    29: </PRE>
1.1       timbl      30: 
2.15      frystyk    31: <PRE>
                     32: typedef struct _HTBTree HTBTree;
1.1       timbl      33: 
2.15      frystyk    34: typedef struct _HTBTree_element HTBTElement;
                     35: </PRE>
1.1       timbl      36: 
2.15      frystyk    37: <H2>Create a Binary Tree</H2>
1.1       timbl      38: 
2.15      frystyk    39: This function creates a new binary tree and uses the comparison
                     40: function when building the tree.
1.1       timbl      41: 
2.15      frystyk    42: <PRE>
                     43: extern HTBTree * HTBTree_new (HTComparer * comp);
2.7       timbl      44: </PRE>
1.1       timbl      45: 
2.15      frystyk    46: <H2>Free storage of the tree but not of the objects</H2>
1.1       timbl      47: 
2.15      frystyk    48: <PRE>
                     49: extern void HTBTree_free (HTBTree * tree);
2.7       timbl      50: </PRE>
2.6       secret     51: 
2.15      frystyk    52: <H2>Free storage of the tree and of the objects</H2>
2.6       secret     53: 
2.15      frystyk    54: <PRE>
                     55: extern void HTBTreeAndObject_free (HTBTree * tree);
2.7       timbl      56: </PRE>
2.6       secret     57: 
2.15      frystyk    58: <H2>Add an object to a binary tree</H2>
1.1       timbl      59: 
2.15      frystyk    60: <PRE>
                     61: extern void HTBTree_add (HTBTree* tree, void * object);
2.7       timbl      62: </PRE>
1.1       timbl      63: 
2.15      frystyk    64: <H2>Return an Object</H2>
1.1       timbl      65: 
2.15      frystyk    66: <PRE>
                     67: extern void * HTBTree_object (HTBTElement * element);
2.7       timbl      68: </PRE>
1.1       timbl      69: 
2.15      frystyk    70: <H2>Find next element in depth-first order</H2>
1.1       timbl      71: 
2.7       timbl      72: <H3>On entry,</H3>
1.1       timbl      73: 
2.15      frystyk    74: If <CODE>element</CODE> is NULL then start with leftmost element. if
                     75: not NULL then give next object to the right. The function returns a
                     76: pointer to element or NULL if none left.
1.1       timbl      77: 
2.15      frystyk    78: <PRE>
                     79: extern HTBTElement * HTBTree_next (HTBTree * tree, HTBTElement * element);
                     80: </PRE>
                     81: 
                     82: <PRE>
2.10      frystyk    83: #endif
                     84: </PRE>
2.15      frystyk    85: 
                     86: End of declaration of BTree
2.10      frystyk    87: </BODY>
                     88: </HTML>

Webmaster