Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. tree array_to_tree (int *num, int inf, int sup) {
  2. tree result;
  3. if (inf > sup)
  4. result = NULL;
  5. else {
  6. unsigned int middle = (inf + sup) / 2;
  7. result = NULL;
  8. insert_tree (num[middle], result);
  9. result->left = array_to_tree(num, inf, middle-1);
  10. result->right = array_to_tree(num, middle+1, sup);
  11. }
  12. return result;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement