Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public class BinaryTreeNode { private int item; private BinaryTreeNode parent, left, right; public BinaryTreeNode(int item, BinaryTreeNode parent, BinaryTreeNode left, BinaryTreeNode right) { this.item = item;

public class BinaryTreeNode { private int item; private BinaryTreeNode parent, left, right; public BinaryTreeNode(int item, BinaryTreeNode parent, BinaryTreeNode left, BinaryTreeNode right) { this.item = item; this.parent = parent; this.left = left; this.right = right; } public int getItem() { return item; } public BinaryTreeNode getParent() { return parent; } public BinaryTreeNode getLeft() { return left; } public BinaryTreeNode getRight() { return right; } public void setItem(int item) { this.item = item; } public void setParent(BinaryTreeNode parent) { this.parent = parent; } public void setLeft(BinaryTreeNode left) { this.left = left; } public void setRight(BinaryTreeNode right) { this.right = right; } }
----------------------------other class-------------------------- public class BinarySearchTree { private int size; private BinaryTreeNode root; public BinarySearchTree() { this.root = null; this.size = 0; } public BinaryTreeNode getRoot() { return this.root; } public int getSize() { return this.size; } /** * Deletes a Node containing the given integer. If the Node has 2 children, replaces with the Node of the minimum * value in the right child of the node. If the data is not present, returns null. * @param data The integer to be removed * @return The Node containing the integer to remove or null if one is not found */ public BinaryTreeNode remove(int data) { // TODO } /** * Deletes a Node containing the given integer. If the Node has 2 children, replaces with the Node of the maximum * value in the left child of the node. If the data is not present, returns null. * @param data The integer to be removed * @param curNode The current Node in the traversal * @return The Node containing the integer to remove or null if one is not found */ private BinaryTreeNode remove(int data, BinaryTreeNode curNode) { // TODO }

Please solve TODO and these two classes all I have.

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

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions

Question

How many digits are in the decimal expansion of 10^(20)

Answered: 1 week ago

Question

2. What, according to Sergey, was strange at this meeting?

Answered: 1 week ago

Question

3. Are our bosses always right? If not, what should we do?

Answered: 1 week ago