Which of the following functions returns the sum of leaves of given tree? O int sumleaves (tree_node* r) { if (r-=NULL)
Posted: Sat May 14, 2022 4:57 pm
Which of the following functions returns the sum of leaves of given tree? O int sumleaves (tree_node* r) { if (r-=NULL) return 0; if (r->left == NULL && r->right==NULL) return r->val; return sumleaves (r->left) + sumleaves (r->right); O int gumleaves (tree node* 1) { if (r==NULL) return 0; if (r->left NULL && r->right==NULL) return r->val; return sumleaves (r->left) + gumleaves (r->right) + r->val; } O int sumleaves (tree node* r) { if (r->left NULL && r->right==NULL) return r->val; return sumleaves (r->left) + gumleaves (r->right) + r->val; O int sumleaves (tree node* r) { if (x==NULL) return 0; if (r->left == NULL && r->right==NULL) return r->val; 1