Consider the following recursive definition of a function search that performs search in a binary tree.
bool search(Type a, Tree T) { if (empty(T)) { return false; } else if(a == data(T)) { return true; } else { bool bl = search(a, left(L)); bool br = search(a, right(L)); return bl || br; } }
Which of the following describes a problem with the function when executed?
Consider the following pseudo-code, which indicates part of a standard binary tree algorithm.
print( node ) { print data; if( there is a left child ) print( left child ); if( there is a right child ) print( right child ); }
Which of the following is the standard name for this algorithm?
Suppose S is a binary search tree and x is not an element of S. Consider the following code fragment.
S.remove( x ); S.insert( x );
If T is the tree that results from executing the fragment, what is the relationship between S and T?