// Fragment - Search for an item in Binary Search Tree T retrieveItem(TreeNode n, long searchKey) // returns a node containing the item with the key searchKey // or null if not found { if (n == null) { return null; } else { if (searchKey == n.getItem().getKey()) { // item is in the root of some subtree return n.getItem(); } else if (searchKey < n.getItem().getKey()) { // search the left subtree return retrieveItem(n.getLeft(), searchKey); } else { // search the right subtree return retrieveItem(n.getRight(), searchKey); } // end if } // end if } // end retrieveItem