Java Reference
In-Depth Information
14.
draw two different binary trees such that the pre-order and post-order traversals of the one
tree are identical to the pre-order and post-order traversals of the other tree.
15.
Write a recursive function that, given the root of a binary tree and a key, searches for the key
using (i) a pre-order, (ii) an in-order, and (iii) a post-order traversal. If found, return the node
containing the key; otherwise, return null .
16.
store the following integers in an array bst[1..15] such that bst represents a complete
binary search tree:
34 23 45 46 37 78 90 2 40 20 87 53 12 15 91
17.
each node of a binary search tree contains three fields— left , right , and data —with their
usual meanings; data is a positive integer field. Write an efficient function that, given the root
of the tree and key , returns the smallest number in the tree that is greater than key . If there
is no such number, return -1.
18.
Write a program that takes a Java program as input and outputs the program, numbering the
lines, followed by an alphabetical cross-reference listing of all user identifiers; that is, a user
identifier is followed by the numbers of all lines in which the identifier appears. If an identifier
appears more than once in a given line, the line number must be repeated the number of
times it appears.
the cross-reference listing must not contain Java reserved words, words within character
strings, or words within comments.
Search WWH ::




Custom Search