Page 1 of 1

tree_node class is defined as follows: class tree_node public: int val; tree_node *left, right; tree_node(int v, tree_no

Posted: Sat May 14, 2022 4:58 pm
by answerhappygod
Tree Node Class Is Defined As Follows Class Tree Node Public Int Val Tree Node Left Right Tree Node Int V Tree No 1
Tree Node Class Is Defined As Follows Class Tree Node Public Int Val Tree Node Left Right Tree Node Int V Tree No 1 (35.02 KiB) Viewed 23 times
tree_node class is defined as follows: class tree_node public: int val; tree_node *left, right; tree_node(int v, tree_node* 1=NULL, tree_node* ==NULL) val - Vi left - 1; right = 1; 1 ); What does the following function f do? void E(tree_node* ) if (NULL) return; r->val++; f (r->left); f (r->right); 1 It only increments the value of leaves of the tree by 1. It only increments the value of the root by 1. It increments the values of every single node in the tree by 1. It doens't make any change to the tree. QUESTION 10 What does the following recursion function f return when a positive number n is passed? int f(int n) if (n) return 0; return f(n-1) *n; } n! n 1+2+3+...n O regardless of what positive number is passed to funciton QUESTION 11 Which of the following sorting algorithms has the best best case complexity? quick sort merge sort Insertion sort selection sort