3. Draw the binary search tree that would be generated from the following input sequence.
24 39 13 7 3 15 29 54 40 22 19
4. Using the following class definition segment for the class card implement the friend function
for operator <<, assuming that the classes suit and pips both contain overloaded operators for
the operator <<.
class card
{
private: suit s;
pips p;
public: …
friend ostream & operator << (ostream & out, const card & c);
};
5. Why should the recursive clear function be written using a post order traversal, rather than an
in order or pre order traversal?
6. A template parameter can be used as
A. A return type
B. The data type of a parameter
C. The data type of a local variable in the function
D. All of the above are valid uses for a template variable
7. Which of the following operators can not be overloaded?
A. *, the multiplication operator
B. >>, the input operator
C. ::, the scope resolution operator
D. All of the above can be overloaded.
8. The number of children that a node in a binary tree may have is:
A. 0
B. 1
C. 2
D. A node in a binary tree may have between 0 to 2 children.
9. When printing a binary tree using a pre order traversal the first node to be printed is:
A. The root node
B. The leftmost leaf node
C. The rightmost leaf node
D. None of the above.
10. When printing a binary tree using a in order traversal the first node to be printed is;
A. The root node
B. The leftmost leaf node
C. The rightmost leaf node
D. None of the above.