public class BST<Keys extends Comparable<Key>, Value> { Iterable<Key> keys() { Queue<Key> keylst = new Queue<Key>(); addKeys(root, lst); return lst; } /** * adds the keys in subtree t in order to the end of lst * @param t the subtree * @param lst list of keys smaller than the keys in t. */ private void addKeys(Node t, Queue<Key> lst) { /** * (Like printKeys, but add to lst instead of printing: * * if t is empty do nothing (just return) * add keys from the left subtree * add t.key * add keys from the right subtree */ } }