Question: java Suppose your program randomly tests whether a student is in a class and also need to know the studentis information such as name, id

java

java Suppose your program randomly tests whether a student is in a

class and also need to know the studentis information such as name,

Suppose your program randomly tests whether a student is in a class and also need to know the studentis information such as name, id and grades. what is the best data structure to store the students in the class? O HashSet O LinkedList O HashMap OTreeMap O ArrayList Which of the following statements about the insert method below for Binary Search Tree are TRUE? Choose TWO. Line 01: public boolean insert(E e) { Line 02: if (root == null) Line 03: root = new TreeNode(e); Line 04: else { Line 05: TreeNode parent = null; Line 06: TreeNode current = root; Line 07: while (current != null) { Line 08: if (e.compareTo(current.element) 0) { Line 13: parent = current; Line 14: current = current.right; Line 15: } Line 16: else Line 17: return false; Line 18: } Line 19: if (e.compareTo(parent.element) (e); Line 21: else Line 22: parent.right = new TreeNode(e); Line 23: } Line 24: size++; Line 25: return true; Line 26: } When the program reaches Line 19, current is not null. When the program reaches Line 19, parent does not have any children. When the program reaches Line 10, current is a child of parent. The only thing that stops the while loop at Line 07 is when current is null

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Question 1 Best Data Structure to Store Students Requirement Random testing if a student is in the c... View full answer

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!