Midterm 2 Review

If

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ult in a binary search tree of height N – 1 when you are inserting N distinct keys ? 22) Exhibit the expression tree corresponding to the expression: ((a + b * c))* d + e * (f + g) 23) Preorder traversal of a binary search tree produces the sequence 5 3 18 13 9 14 21 24. Construct the tree. 24) Given a pointer to a node N in a binary search tree and a key x, you are to write a procedure that finds outputs the node in the subtree rooted at N that contains the smallest key larger than x. If such a node does not exist, it should a NULL pointer. HINT: compare x with key at N. If key(N) < x, continue the search recursively on the right subtree. If key(N) = x, then output the node containing the minimum key on the right subtree. If key(N) &...
View Full Document

Ask a homework question - tutors are online