Answer: D:) people
Explanation: I search it up
Answer:
The solution is implemented using C++
int getRowTotal(int a[][5], int row) {
int sum = 0;
for(int i =0;i<5;i++)
{
sum += a[row][i];
}
return sum;
}
Explanation:
This defines the getRow function and the parameters are arr (the 2 d array) and row and integer variable
int getRowTotal(int arr[][5], int row) {
This defines and initializes sum to 0
int sum = 0;
This iterates through the row and adds the row items
<em> for(int i =0;i<5;i++) {
</em>
<em> sum += arr[row][i];
</em>
<em> }
</em>
This returns the calculated sum
return sum;
}
Answer:
public boolean equals(Object other)
{
// check correct instance
if (other instanceof IntTree)
{
try
{
IntTree otherTree = (IntTree) other;
return equals(overallRoot, otherTree.overallRoot);
}
// caught exceptions
catch (Exception e)
{
return false;
}
}
return false;
}
public boolean equals(IntTreeNode tree1, IntTreeNode tree2)
{
// if reach ends
if (tree1 == null && tree2 == null)
{
// they are equal
return true;
}
else if (tree1 == null || tree2 == null)
{
// not equal
return false;
}
// check left part
boolean leftPart = equals(tree1.left, tree2.left);
// check current element is same
boolean currentPart = tree1.element.equals(tree2.element);
// check right part
boolean rightPart = equals(tree1.right, tree2.right);
// all are equal
return (leftPart && currentPart && rightPart);
}
Explanation: