Question: how to write this in c++, the pseudo code is availble already ------------------------------------------------------------ // Helper method for completions(). // // Suggested base cases: // If
how to write this in c++, the pseudo code is availble already
------------------------------------------------------------
// Helper method for completions().
//
// Suggested base cases:
// If root is nullptr, return.
// If the last entry of the suggestions array is not "", return.
// (since completions() has already found 5 suggestions).
//
// Suggested recursive case:
// -If left subtree can contain strings that start with x,
// recurse on left subtree.
// -If root's string starts with x,
// add root->s to first empty location in results.
// -If right subtree can contain strings that start with x,
// recurse on right subtree.
void 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
