Solution:
(32)
=>Node to be inserted = 62
The answers will be:
left of right: left
node: 64
Explanation:
=>In binary search tree(BST) a node with value less than node is inserted at the left part of root otherwise right part of the node.
=>The above property is being followed for every node of the tree.
=>62 > 50 hence it will be inserted at the right side of 50.
=>62 < 70 hence it will be inserted at the left side of 70.
=>62 > 60 hence it will be inserted at the right side of 60.
=>62 < 65 hence it will be inserted at the left side of 65.
=>62 < 64 hence it will be inserted at the left side of 64.
(33)
The answers will be:
Predecessor: 40
Successor: 60
Explanation:
Finding predecessor of 50:
=>Predecessor of a node is the maximum value in the left subtree of that node.
=>Precessor of 50 = 40
Finding successor of 50:
=>Successor of a node is the minimum value in the right subtree of that node.
=>Successor of 50 = 60
(34)
=>Successor is used for deleting the nodes.
=>Nodes to be deleted in order = 80, 40, 50
Explanation:


I have explained each and every part with the help of statements as well as images attached to the answer above.
hi, I am suppose to implement that method in java for bst but the result doesn't work as excpected * _Part 8: Implement this method._ * * toString() is a method defined by Java's Object class * that can be used to provide a String representation for your * class. It is called anytime you concatenate an Object to * a String. * * Build a string representation of the BST that describes both * the values stored inside and...
package hw3; import java.util.LinkedList; /* *********************************************************************** * A simple BST with int keys and no values * * Complete each function below. * Write each function as a separate recursive definition (do not use more than one helper per function). * Depth of root==0. * Height of leaf==0. * Size of empty tree==0. * Height of empty tree=-1. * * TODO: complete the functions in this file. * DO NOT change the Node class. * DO NOT change the name...
Consider the following values: 20, 10, 45, 23, 46, 75, 15. What value will be at the root of the tree created by inserting these values in the order given to build a min heap? a. 10 b. 23 c. 20 d. 75 Consider the following tree with root value 20, 20 has a left child of 10 and a right child value 30; 10 has a left child of 5 and a right child of 15; 30 has a...
write a new test program called RemoveDuplicates.java. The program reads text input from keyboard or a text file and adds the words to a BST. The program then traverses the BST and prints out the words in order (based on ASCII/UNICODE order) on the screen (or to output text file). Note that you may need to make some changes to BST.java. Sample test: ----jGRASP exec: java -ea removeDuplicates Original Text: a B 2 n w C q K l 0...
QUESTION 9
Consider the following binary search tree:
If the root node, 50, is deleted, which node will become the new
root?
A
15
B
24
C
37
D
62
QUESTION 10
In the following trees EXCEPT______, the left and right subtrees
of any node have heights that differ by at most 1.
A
complete trees
B
perfect full trees
C
balanced binary trees
D
binary search trees
QUESTION 11
A perfect full binary tree whose height is 5 has...
P $70 $65 $60 $55 $50 ATC $45 $40 $35 AVC MR $30 $25 $20 $15 $10 $5 01234 56789 10 11 12 13 14 Based on the graph above, what is the profit maximizing price? o $45 $25 $5 S40 O $20 $10 $70 $50 S60 $65 S55 SI5 S30 $35
80 75 70 65 60 55 50 45 40 35 30 25 20 D2 S Price of TV Remote in Dollars D1 0 20 40 60 80 100 120 140 160 Quantity of TV Remotes The above graph shows the supply curve and 2 possible demand curves for a perfectly competitive, constant cost TV remote market. Assume the demand curve is initially D1 and the market is in long run equilibrium. Now assume a very popular new TV show comes...
Write a C++ program to validate computer user-ids and passwords. A list of valid ids and passwords (unsorted) is read from a file and stored in a Binary Search Tree (BST) of UserInfo objects. When user-ids and passwords are entered during execution, this BST is searched to determine whether they are legal. Input (file): UserInfo records for valid users Input (keyboard): Ids and passwords of users logging in Output (screen): Messages indicating whether user-ids and passwords are valid, as well...
Assignment on Java programing 1. Write programs for the following exercises in Java. Each file should have short description of the implemented class and for files with main method the problem it is solving. Make sure your files have appropriate names. Programs should write output to the Console. b) BST: Implement Binary Search Tree ADT with insert(int key), delete(int key), Node find(int key), and in-order traverse() where it prints the value of the key. Your operations should use recursion. The...