Question: how would you input that // Helper method for completion_count). Here'sa (recursive) algorithm Base case: If root is nullptr, then return e Recursive case -Return
how would you input that
// Helper method for completion_count). Here'sa (recursive) algorithm Base case: If root is nullptr, then return e Recursive case -Return the sum of the completion counts of the left and right subtrees plus if root->s does not start with x. 1 if root->s does start with x. Fint Autocompleter::completion_count_recurse(string x,Node* root) E// Helper method for completions() Here'sa (recursive) algorithm Base case: I If root is nullptr, return. f If the last entry of the suggestions array is not, return I (since completions() has already found 5 suggestions) Recursive case -Recurse on left subtree If root->s starts with x, add root->s to first empty location in suggestions -Recurse on right subtree. Evoid Autocompleter::completions_recurse(string x, string suggestions, Node root)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
