(Solved) : Question 3 Question Binary Search Trees Recall Binary Search Tree Node Declared Follows P Q42729124 . . .

Data Structure

Question 3: This question is about Binary Search Trees and A. Recall that a binary search tree node is declared as follows: public class BSTNode { public int key; public BSTNode left; public BSTNode right; 1. Write a method that given a reference to the root of a binary search tree, print all of the even numbers in sorted order. public static void printEvenSorted (BSTNode root) { 2. Write a method that given a reference to the root of a binary search tree and a particular key, returns a reference to the node that contains that key or null if the key is not found public static BSTNode search(BSTNode root, int key) C. Write a method that takes in a Set as a parameter and returns the maximum number in the set. NB. This set is not guaranteed to be a TreeSet public static int max(Set Integer set) { Show transcribed image text Question 3: This question is about Binary Search Trees and A. Recall that a binary search tree node is declared as follows: public class BSTNode { public int key; public BSTNode left; public BSTNode right; 1. Write a method that given a reference to the root of a binary search tree, print all of the even numbers in sorted order. public static void printEvenSorted (BSTNode root) { 2. Write a method that given a reference to the root of a binary search tree and a particular key, returns a reference to the node that contains that key or null if the key is not found public static BSTNode search(BSTNode root, int key)
C. Write a method that takes in a Set as a parameter and returns the maximum number in the set. NB. This set is not guaranteed to be a TreeSet public static int max(Set Integer set) {

Answer to Question 3: This question is about Binary Search Trees and A. Recall that a binary search tree node is declared as follo…