public bool IsEqual(Node first, Node second)
{
if (first == null && second == null) return true;
if(first != null && second != null)
{
return first.data == second.data &&
IsEqual(first.rightChild,second.rightChild) &&
IsEqual(first.leftChild,second.leftChild);
}
return false;
}
// Node structure
public class Node
{
private int data;
private Node leftChild;
private Node rightChild;
public Node(int data)
{
this.data = data;
}
}
compare(tree1 ,tree2 ){
let x =tree1.count()
let y =tree2.count()
if(x==y)return true; else return false;
}
//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
Code Example |
---|
:: |
Csharp :: |
:: unity button press onclick click add C# |
:: .net mvc c# alert to client browswer window |
:: |
:: |
:: unity look at target |
Csharp :: |
:: |
:: |
Csharp :: |
Csharp :: |
:: |
Csharp :: |
Csharp :: |
Csharp :: |
:: |
:: |
:: |
Csharp :: |
:: |
:: unity c# debug.log |
:: |
Csharp :: |
:: |
:: |
Csharp :: |
Csharp :: |
:: |
:: |