home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
OBJASM.ZIP
/
OUNEWTRE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1989-05-24
|
670b
|
24 lines
#include <stdio.h>
#include "o.h"
NODE_T *new_tree( data_ptr, dup_allowed )
char *data_ptr;
int dup_allowed;
{
NODE_T *tree;
tree = (NODE_T *)o_malloc(sizeof(NODE_T));
tree->data = data_ptr;
if ( dup_allowed ) { /* Hide the duplicates allowed indicator */
tree->balance = LEFT; /* in the tree root's balance! */
} else {
tree->balance = RIGHT;
}
tree->ptr [LEFT ] = 0; /* Hide the tree depth in left pointer */
tree->ptr [RIGHT] = (NODE_T *)tree;
tree->thread[LEFT ] = TRUE;
tree->thread[RIGHT] = TRUE;
return( tree );
}