The BTNodeGen instance method search(T s) in the class above is intended to return the depth of the data items in the tree if it is found, and r eturn -1 if item s is not found in the tree. Given the tree below, show the output that will be produced if the main() fragment were run, assuming the tree, t, is the followi ng: Output: Searching A at: Searching C at: Searching X at: "A" /\ "B" "C" // "D" "E" (depth 1) (depth 2) (depth 3)

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Yusuf: C X
0
F1
umn.instructure.com/courses/342857/external_tools/retrieve?display=full_width&url=https%3A%2F%2Fumn.quiz-Iti-iad-prod.instructure.com
...
D
2
L
Given: Member m = new Board Member();
What will be printed by: System.out.println(m.toString());
۲
3
F2
W ..
ص
X
Output:
Searching A at:
Searching C at:
Searching X at:
Searching Et:
S >>>
س
eturn -1 if
The BTNodeGen<T> instance method search(T s) in the class above is intended to return the depth of the data items in the tree if it is found, and r
item s is not found in the tree. Given the tree below, show the output that will be produced if the main() fragment were run, assuming the tree, t, is the followi
ng:
#
3 r
L
E
20
F3
$
4
ی D
уу.
ي
Without actually re-writing the code, briefly describe two changes needed to make search(T s) give the correct output.
R
W
F
L. G
000
900
F4
in with this one. thi
Gill
5
ق
67 5⁰
"A" (depth 1)
"B" "C" (depth 2)
//
(depth 3)
"D" "E"
%
<< [
O
F5
G
A
T ....
L
6
b Login | bartleby
ف
ل
MacBook Air
244.
F6
>
&
។ 7 V 8
28
Y.2⁰.
AA
F7
غ
ز
*
H IJ
X
U ....
o: W
E
A
CSV B INIM
J
G Sign in - Google Accounts
|
J Σ
DII
F8
( )
9
3 9
K
9
9
C.
0 [
V
F9
1
0
H
X
L
V
(
77
Settings - Passwords
iCloud Storage is Full .
Upgrade your storage to keep
using iCloud.
r
A
F10
P 1
V
II
V
F11
alt
?
+ 11
{
}
て [ ]
>
1
X
S
+
1
F12
x
5.
Upgrade
--
0:
dele
←
Transcribed Image Text:Yusuf: C X 0 F1 umn.instructure.com/courses/342857/external_tools/retrieve?display=full_width&url=https%3A%2F%2Fumn.quiz-Iti-iad-prod.instructure.com ... D 2 L Given: Member m = new Board Member(); What will be printed by: System.out.println(m.toString()); ۲ 3 F2 W .. ص X Output: Searching A at: Searching C at: Searching X at: Searching Et: S >>> س eturn -1 if The BTNodeGen<T> instance method search(T s) in the class above is intended to return the depth of the data items in the tree if it is found, and r item s is not found in the tree. Given the tree below, show the output that will be produced if the main() fragment were run, assuming the tree, t, is the followi ng: # 3 r L E 20 F3 $ 4 ی D уу. ي Without actually re-writing the code, briefly describe two changes needed to make search(T s) give the correct output. R W F L. G 000 900 F4 in with this one. thi Gill 5 ق 67 5⁰ "A" (depth 1) "B" "C" (depth 2) // (depth 3) "D" "E" % << [ O F5 G A T .... L 6 b Login | bartleby ف ل MacBook Air 244. F6 > & ។ 7 V 8 28 Y.2⁰. AA F7 غ ز * H IJ X U .... o: W E A CSV B INIM J G Sign in - Google Accounts | J Σ DII F8 ( ) 9 3 9 K 9 9 C. 0 [ V F9 1 0 H X L V ( 77 Settings - Passwords iCloud Storage is Full . Upgrade your storage to keep using iCloud. r A F10 P 1 V II V F11 alt ? + 11 { } て [ ] > 1 X S + 1 F12 x 5. Upgrade -- 0: dele ←
0:
2 ۲ 3 ۳
WE
ce
S >>>
3
D
00 2
20
F3
public int getMaxDepth() { // assuming root is at depth 1
// recursive getMaxDepth -- returns depth starting from current node
y y
}
if ((left == null) && (right == null))
return 1;
else if (left == null)
}
else if (right == null)
else
}
public BTNodeGen<T> removeRightMost() {
// removes right most node and returns modified (smaller) tree
$
4
return (1 + right.getMaxDepth());
}
if (right == null)
return left;
turn (1 + left.getMaxDepth());
else {
return (1 + (int) Math.max (left.getMaxDepth(),
right.getMaxDepth()));
public BTNodėGen<T> remove Left Most() {
// removes left most node and returns the new (smaller) tree
}
if (left == null)
return right;
setRight (right.removeRightMost());
return this;
else {
}
public T getLeftMostDataR() {
// recursive getLeftMostData method
// returns the left most Object found under this node
R
F ی
public T getLeftMostDataI() {
// iterative getLeftMost Data method
// returns the left most Obiect found under this node
setLeft (left.removeLeftMost());
return this;
if (left == null)
return data;
élse
return left.getLeftMostDataR();
888
F4
11:9
%
675
J.
F5
T ....
G
F6
&
6 1 7 V8
Y
·
F7
W
U ....
w
E
Page < 2
ні
T J
DII
F8
A 9 9
I
J
9
K
F9
> of 4
C.
L.N
c
O
F10
phone interview
7/28/22, 1:00 PM
O [P 1
-N
२
-
て
Transcribed Image Text:0: 2 ۲ 3 ۳ WE ce S >>> 3 D 00 2 20 F3 public int getMaxDepth() { // assuming root is at depth 1 // recursive getMaxDepth -- returns depth starting from current node y y } if ((left == null) && (right == null)) return 1; else if (left == null) } else if (right == null) else } public BTNodeGen<T> removeRightMost() { // removes right most node and returns modified (smaller) tree $ 4 return (1 + right.getMaxDepth()); } if (right == null) return left; turn (1 + left.getMaxDepth()); else { return (1 + (int) Math.max (left.getMaxDepth(), right.getMaxDepth())); public BTNodėGen<T> remove Left Most() { // removes left most node and returns the new (smaller) tree } if (left == null) return right; setRight (right.removeRightMost()); return this; else { } public T getLeftMostDataR() { // recursive getLeftMostData method // returns the left most Object found under this node R F ی public T getLeftMostDataI() { // iterative getLeftMost Data method // returns the left most Obiect found under this node setLeft (left.removeLeftMost()); return this; if (left == null) return data; élse return left.getLeftMostDataR(); 888 F4 11:9 % 675 J. F5 T .... G F6 & 6 1 7 V8 Y · F7 W U .... w E Page < 2 ні T J DII F8 A 9 9 I J 9 K F9 > of 4 C. L.N c O F10 phone interview 7/28/22, 1:00 PM O [P 1 -N २ - て
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY