Given the values in order: 5 8 10 30 34 50 68 80 98 restore the binary search tree of minimum height using the code shown below: void Restore(ifstream & infile, ptrType & nodePtr, int numOfRecords) { if (numOfRecords > 0) { nodePtr = new treeNode; Restore (infile, nodePtrLChildPtr, numOfRecords/2); infile >> newItem; // overloaded >> operator nodePtrItem = newItem // overloaded = operator Restore(infile, nodePtrRChildPtr, (numOfRecords-1)/2 } else nodePtr = NULL; } After the BST tree is built, show the order of the nodes when post-order traversal is applied.
Given the values in order: 5 8 10 30 34 50 68 80 98
restore the binary search tree of minimum height using the code shown below:
void Restore(ifstream & infile, ptrType & nodePtr, int numOfRecords)
{
if (numOfRecords > 0)
{
nodePtr = new treeNode;
Restore (infile, nodePtrLChildPtr, numOfRecords/2);
infile >> newItem; // overloaded >> operator
nodePtrItem = newItem // overloaded = operator
Restore(infile, nodePtrRChildPtr, (numOfRecords-1)/2
}
else
nodePtr = NULL;
}
After the BST tree is built, show the order of the nodes when post-order traversal is applied.

Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images









