Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

compare two binary tree

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;
    }
}
Comment

compare binary trees

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 ( ͡~ ͜ʖ ͡°)
Comment

PREVIOUS NEXT
Code Example
Csharp :: tooltips unity 
Csharp :: c# find one object in list where 
Csharp :: discord bot status code c# 
Csharp :: c# append textbox 
Csharp :: c# streamwriter 
Csharp :: singleton unity 
Csharp :: tinyint in c# 
Csharp :: c# countdown timer menutes 
Csharp :: odd or even in c# 
Csharp :: read input c# 
Csharp :: c# timer 
Csharp :: custom array initializer in c# 
Csharp :: c# tostring currency 
Csharp :: get time from datetime c# 
Csharp :: unity get all components in gameobject 
Csharp :: wpf set color in code 
Csharp :: convert string to int and read it 
Csharp :: unity assembly 
Csharp :: decalre an int list mvc 
Csharp :: header export excel data only php 
Csharp :: c# return switch 
Csharp :: get layermask from gameobject layer unity 
Csharp :: unity debug c# code with console 
Csharp :: const class in c sharp 
Csharp :: defaultrequestheaders.authorization basic auth 
Csharp :: c# onmousedown. unity 
Csharp :: c# is in array 
Csharp :: nested dictionary c# 
Csharp :: httpcontext.current.session null c# in class library 
Csharp :: clamp vector3 unity 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =