Skip to content

Conversation

@tom-huntington
Copy link

Study the logic below or do a printf on the unit test

`static inline void BSTree_setnode(BSTree * map, BSTreeNode * node,
void *key, void *data)
{
int cmp = map->compare(node->key, key);

if (cmp <= 0) { if (node->left) { BSTree_setnode(map, node->left, key, data); } else { node->left = BSTreeNode_create(node, key, data); } } else { if (node->right) { BSTree_setnode(map, node->right, key, data); } else { node->right = BSTreeNode_create(node, key, data); } } 

}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant