Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IMPORTANT NOTE: For the Question you need to provide a BST java file containing the source code. The java code should start with a commented

IMPORTANT NOTE: For the Question you need to provide a BST java file containing the source code. The java code should start with a commented block explaining how to compile and run your implementation.

image text in transcribed

Consider the following definitions of BSTNode and BST classes: public class BSTNode> I protected T el; protected BSTNode left, right; public BSTNode ) l public BSTNode (T el) I this (el,null,null); public BSTNode (T el, BSTNode lt, BSTNode rt) i this.el - el; left - lt; right -rt; public class BST> t protected BSTNode root = null; ublic BST) Implement the following methods in class BST 1. 2. 3. 4. 5. countRightChildren: to count the number of right children in a BST. getHeight: to find the height of the tree checkBalanced: to check if the tree is perfectly balanced checkBST: to check if the tree is a binary search tree. getDescendentsList: to return the list (ArrayList) of the descendents of a node given as parameter getAncestorsList: to return the list (ArrayList) of the ancestors of a node given as parameter. 6. Consider the following definitions of BSTNode and BST classes: public class BSTNode> I protected T el; protected BSTNode left, right; public BSTNode ) l public BSTNode (T el) I this (el,null,null); public BSTNode (T el, BSTNode lt, BSTNode rt) i this.el - el; left - lt; right -rt; public class BST> t protected BSTNode root = null; ublic BST) Implement the following methods in class BST 1. 2. 3. 4. 5. countRightChildren: to count the number of right children in a BST. getHeight: to find the height of the tree checkBalanced: to check if the tree is perfectly balanced checkBST: to check if the tree is a binary search tree. getDescendentsList: to return the list (ArrayList) of the descendents of a node given as parameter getAncestorsList: to return the list (ArrayList) of the ancestors of a node given as parameter. 6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

ISBN: 1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

Why do people give gifts?

Answered: 1 week ago