Question: 2. Write a function that recursively traverses a BST. The function will print out the values in postorder, preorder, or inorder which is indicated by

2.

Write a function that recursively traverses a BST. The function will print out the values in postorder, preorder, or inorder which is indicated by a parameter to the function. The order is based on this enum:

typedef enum OrderBy { POSTORDER, PREORDER, INORDER } OrderBy;

The function has the following:

(2 pts) Return type, identifier, and any parameters

(4 pts) Recursively traverses the BST.

(4 pts) Compares the order parameter against the enum for the order.

(2 pts) Prints out the BST nodes value based on the correct order. Assume the data member is named value.

Answer ASAP

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!