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

2.8       frystyk     1: <HTML>
                      2: <HEAD>
2.18      frystyk     3: <TITLE>W3C Sample Code Library libwww Balanced Binary Tree</TITLE>
2.17      frystyk     4: <!-- Changed by: Henrik Frystyk Nielsen, 23-Mar-1996 -->
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.19      frystyk    21: it is a part of the <A HREF="http://www.w3.org/Library/"> W3C
2.18      frystyk    22: Sample Code 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.20    ! vbancrof   29: 
        !            30: #ifdef __cplusplus
        !            31: extern "C" { 
        !            32: #endif 
        !            33: 
2.10      frystyk    34: </PRE>
1.1       timbl      35: 
2.15      frystyk    36: <PRE>
                     37: typedef struct _HTBTree HTBTree;
1.1       timbl      38: 
2.15      frystyk    39: typedef struct _HTBTree_element HTBTElement;
                     40: </PRE>
1.1       timbl      41: 
2.15      frystyk    42: <H2>Create a Binary Tree</H2>
1.1       timbl      43: 
2.15      frystyk    44: This function creates a new binary tree and uses the comparison
                     45: function when building the tree.
1.1       timbl      46: 
2.15      frystyk    47: <PRE>
                     48: extern HTBTree * HTBTree_new (HTComparer * comp);
2.7       timbl      49: </PRE>
1.1       timbl      50: 
2.15      frystyk    51: <H2>Free storage of the tree but not of the objects</H2>
1.1       timbl      52: 
2.15      frystyk    53: <PRE>
                     54: extern void HTBTree_free (HTBTree * tree);
2.7       timbl      55: </PRE>
2.6       secret     56: 
2.15      frystyk    57: <H2>Free storage of the tree and of the objects</H2>
2.6       secret     58: 
2.15      frystyk    59: <PRE>
                     60: extern void HTBTreeAndObject_free (HTBTree * tree);
2.7       timbl      61: </PRE>
2.6       secret     62: 
2.15      frystyk    63: <H2>Add an object to a binary tree</H2>
1.1       timbl      64: 
2.15      frystyk    65: <PRE>
                     66: extern void HTBTree_add (HTBTree* tree, void * object);
2.7       timbl      67: </PRE>
1.1       timbl      68: 
2.15      frystyk    69: <H2>Return an Object</H2>
1.1       timbl      70: 
2.15      frystyk    71: <PRE>
                     72: extern void * HTBTree_object (HTBTElement * element);
2.7       timbl      73: </PRE>
1.1       timbl      74: 
2.15      frystyk    75: <H2>Find next element in depth-first order</H2>
1.1       timbl      76: 
2.7       timbl      77: <H3>On entry,</H3>
1.1       timbl      78: 
2.15      frystyk    79: If <CODE>element</CODE> is NULL then start with leftmost element. if
                     80: not NULL then give next object to the right. The function returns a
                     81: pointer to element or NULL if none left.
1.1       timbl      82: 
2.15      frystyk    83: <PRE>
                     84: extern HTBTElement * HTBTree_next (HTBTree * tree, HTBTElement * element);
                     85: </PRE>
                     86: 
                     87: <PRE>
2.20    ! vbancrof   88: #ifdef __cplusplus
        !            89: }
2.10      frystyk    90: #endif
2.20    ! vbancrof   91: 
        !            92: #endif /* HTBTTEE_H */
2.10      frystyk    93: </PRE>
2.15      frystyk    94: 
2.17      frystyk    95: <HR>
                     96: <ADDRESS>
2.20    ! vbancrof   97: @(#) $Id: HTBTree.html,v 2.19 1998/05/14 02:10:16 frystyk Exp $
2.17      frystyk    98: </ADDRESS>
2.10      frystyk    99: </BODY>
                    100: </HTML>

Webmaster