Question: PLEASE ANSWER USING C PROGRAM! // ========================== BEGIN INSERT FUNCTION DEFS TO WALK TREE ========================== // define 4 functions - preorder, inorder, postorder, depthFirst to
| ||
| // associated with each node visited: | ||
| // void preorder (tnode_t* np) {} | ||
| // void inorder (tnode_t* np) {} | ||
| // void postorder (tnode_t* np) {} | ||
| // void deptFirst (tnode_t* np) {} | ||
| void preorder (tnode_t* np) { | ||
| // *** INSERT YOUR CODE HERE *** | ||
| return; | ||
| } | ||
| void inorder (tnode_t* np) { | ||
| // *** INSERT YOUR CODE HERE *** | ||
| return; | ||
| } | ||
| void postorder (tnode_t* np) { | ||
| // *** INSERT YOUR CODE HERE *** | ||
| return; | ||
| } | ||
| void depthFirst (tnode_t* root) { | ||
| tnode_t* temp; // temporary pointer into tree | ||
| queue_t* q; // auxillary queue | ||
| temp = NULL; | ||
| q = newQueue(); | ||
| // *** INSERT YOUR CODE HERE *** | ||
| freeQueue(q); | ||
| return; | ||
| } | ||
| // ========================== END INSERT FUNCTIONS HERE TO WALK TREE ========================== |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
