Name

bitree_merge

Synopsis

int bitree_merge(BiTree *merge, BiTree *left, BiTree *right, const void *data);

Return Value

0 if merging the trees is successful, or -1 otherwise.

Description

Merges the two binary trees specified by left and right into the single binary tree merge. After merging is complete, merge contains data in its root node, and left and right are the left and right subtrees of its root. Once the trees have been merged, left and right are as if bitree_destroy had been called on them.

Complexity

O (1)

Get Mastering Algorithms with C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.