Question: You are given a binary search tree (BST) consisting of N nodes that store integers as elements. Assume that you have access to the BSTNode

 You are given a binary search tree (BST) consisting of N

You are given a binary search tree (BST) consisting of N nodes that store integers as elements. Assume that you have access to the BSTNode and the BST class with the following methods. private class BSTNode {private int id; private BSTNode left; private BSTNode right; public BSTNode (int key, BSTNode l, BSTNode r) {id = key; left = 1; right = r;}} public class BST implements BSTinterface {public void insert (int id); public void remove (int id); public void search (int id); public void printall(); public int height(); public void show)();} (a) Write a method findMin for the class BST above that returns the element with the minimum value in the BST. (b) Write a method findMax for the class BST above that returns the element with the maximum value in the BST. (c) Analyze the running times of findMin and findMax methods for the best case and the worst case. Explain your answer with a picture

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!