Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tree array_to_tree (int *num, int inf, int sup) {
- tree result;
- if (inf > sup)
- result = NULL;
- else {
- unsigned int middle = (inf + sup) / 2;
- result = NULL;
- insert_tree (num[middle], result);
- result->left = array_to_tree(num, inf, middle-1);
- result->right = array_to_tree(num, middle+1, sup);
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement