Remove the following integers in the order presented from the given BSI and show each step of removal by drawing the BSTs after each step of removal in the box below (i.e. 5 trees in total). When removing a node with 2 children, you must replace it with its in-order successor to get credits. Then add the resulting tree in a string format to BSTManual.java. 60 25 40 70 43 65 80 31) 62) 76 Elements to remove: [70, 43, 60, 80, 65] 94) 94

icon
Related questions
Question
/**
 * TODO: file header
 */
 
import java.util.*;
 
public class BSTManual {
 
/**
 * TODO
 * @author TODO
 * @since  TODO
 */
 
// No style for this file.
 
public static ArrayList<String>  insertElements() {
 
ArrayList<String> answer_pr1 = new ArrayList<>(11);
 
/*
* make sure you add your answers in the following format:
* answer_pr1.add("1"); --> level 1 (root level) of the output BST
* answer_pr1.add("2, X"); --> level 2 of the output BST
* answer_pr1.add("3, X, X, X"); --> level 3 of the output BST 
* the above example is the same as the second pictoral example on your
* worksheet
*/
 
//TODO: add strings that represent the BST after insertion. 
return answer_pr1;
 
}
 
public static ArrayList<String>  deleteElements() {
 
ArrayList<String> answer_pr2 = new ArrayList<>(11);
 
/*
* Please refer to the example in insertElements() if you lose track
* of how to properly enter your answers
*/
 
//TODO: add strings that represent the BST after 5 deletions. 
return answer_pr2;
 
}
 
public static ArrayList<String>  traversals() {
 
ArrayList<String> answer_pr3 = new ArrayList<>(11);
 
/*
* In this one, you will add ONLY and EXACTLY 3 strings to answer_pr3
* here's how you do it:
* answer_pr3.add("1, 2, 3, 4, 5") --> in-order traversal result
* answer_pr3.add("1, 2, 3, 4, 5") --> pre-order traversal result
* answer_pr3.add("1, 2, 3, 4, 5") --> post-order traversal result
* replace "1, 2, 3, 4, 5" with your actual answers
*/
//TODO: add 3 strings that represent 3 traversals. 
return answer_pr3;
 
}
 
 
}
Remove the following integers in the order presented from the given BSI and
show each step of removal by drawing the BSTs after each step of removal in
the box below (i.e. 5 trees in total). When removing a node with 2 children, you
must replace it with its in-order successor to get credits. Then add the resulting
tree in a string format to BSTManual.java.
60
25
40
70
43
65
80
31)
62)
76
Elements to remove: [70, 43, 60, 80, 65]
94)
94
Transcribed Image Text:Remove the following integers in the order presented from the given BSI and show each step of removal by drawing the BSTs after each step of removal in the box below (i.e. 5 trees in total). When removing a node with 2 children, you must replace it with its in-order successor to get credits. Then add the resulting tree in a string format to BSTManual.java. 60 25 40 70 43 65 80 31) 62) 76 Elements to remove: [70, 43, 60, 80, 65] 94) 94
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions