Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

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

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

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions

Question

Which are non projected Teaching aids in advance learning system?

Answered: 1 week ago