Ejemplo n.º 1
0
void bst_add(bst* tree, void* element) {
	assert(tree);
	assert(element);

	// Creating the new node
	bst_node* node = bst_create_node(tree->data_size, element);

	if(tree->root)
		bst_add_rec(tree->compare, tree->root, node); // Start recursion
	else {
		tree->root = node; // Setting the new node as the tree's root
	}
}
Ejemplo n.º 2
0
void bst_insert(bst_t *bst, int key) {
	bst_node_t *n = bst_create_node(key);
	bst_insert_node(bst, n);
}