Assume you correctly hooked up the tree structure given in the last problem. Whi
ID: 3709759 • Letter: A
Question
Assume you correctly hooked up the tree structure given in the last problem. Which of the following are valid ways of changing the 'i' in the tree to a 'u'? Here is the code and diagram again: 1-#include stdlib.h> 3- typedef struct node 5 char letter; 6 struct node left; 7 struct node right; 8 Node; 10 Node createNode(char ch) 12 Node n malloc(sizeofCNode)); 13 n->letter-ch; 14 n->left NULL 15 nright NULL 16 1 17 18 int main(void) 19 f 20 Node nodeT createNodeC't 21 Node* nodel-createNode('h') 22 Node node createNodee: 23 Node nodeI createNode 24 Node nodeS createNodeC's 26 Letter struct node ? nodeT. >left-eright-letter" 'u"; nodeT>left->right, > right="u'; U nodeT-right-left letter u' G nodel letter "u U nodeH-right->letter 'u u nodel--letterExplanation / Answer
It is given in the question that we can assume that we have correctly hooked the tree as shown in figure.
i.e we have assigned left and right child for coressponding as per the requirement.
Then to change the value of a node having letter 'i' to 'u' correct statement would be
nodeT->left->right->letter = 'u';
NOTE: nodeT is pointer of type Node
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.