Hi I want to write a method to calculate the depth of a binarytree by a recursiv
ID: 3609486 • Letter: H
Question
Hi I want to write a method to calculate the depth of a binarytree by a recursive function. Here is the class I used public classIntBTNode{
private int data;
private IntBTNode left,right; public int getData() public IntBTNodegetLeft( ) public IntBTNodegetRight( ) public intgetLeftmostData( ) public intgetRightmostData( ) public boolean isLeaf() public IntBTNoderemoveLeftmost( ) public IntBTNoderemoveRightmost( ) public void setData(intnewData) public voidsetLeft(IntBTNode newLeft) public voidsetRight(IntBTNode newRight) } Hi I want to write a method to calculate the depth of a binarytree by a recursive function. Here is the class I used public classIntBTNode
{
private int data;
private IntBTNode left,right; public int getData() public IntBTNodegetLeft( ) public IntBTNodegetRight( ) public IntBTNodegetRight( ) public intgetLeftmostData( ) public intgetRightmostData( ) public boolean isLeaf() public IntBTNoderemoveLeftmost( ) public IntBTNoderemoveRightmost( ) public void setData(intnewData) public voidsetLeft(IntBTNode newLeft) public voidsetRight(IntBTNode newRight) } }
Explanation / Answer
It looks good, but there's some question mark in the answer.could you clarify that? Thank you!
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.