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:
Answer:
void swapAll(int *a1, int *a2, int n){
int i;
int tmp[n];
for(i = 0; i < n; i++){
tmp[i] = a1[i];
a1[i] = a2[i];
a2[i] = tmp[i];
}
}
Explanation:
You just need a temporary structure.
I am going to write a c script, in which a1 and a2 are the arrays and n is the length of the arrays.
void swapAll(int *a1, int *a2, int n){
int i;
int tmp[n];
for(i = 0; i < n; i++){
tmp[i] = a1[i];
a1[i] = a2[i];
a2[i] = tmp[i];
}
}
Answer:
I need some time i answering your question please follow me and thank(sanybody have any friends cute girl or cute sardarni he is my classmate His name Was Kushi ask to Please follow me)
Explanation:
anybody have any friends cute girl or cute sardarni he is my classmate His name Was Kushi ask to Please follow me)
Answer:
Word Status Bar or Status Bar
Explanation: