<h2><a href="https://www.geeksforgeeks.org/problems/determine-if-two-trees-are-identical/1">Determine if Two Trees are Identical</a></h2><h3>Difficulty Level : Easy</h3><hr><div class="problems_problem_content__Xm_eO"><p><span style="font-size: 14pt;">Given two binary trees, the task is to find if both of them are identical or not.<br><strong>Note:</strong> You need to return true or false, the printing is done by the driver code.</span></p>
<p><span style="font-size: 14pt;"><strong>Example 1:</strong></span></p>
<pre><span style="font-size: 14pt;"><strong>Input:
</strong>     1          1
&nbsp;  /   \      /   \
&nbsp; 2     3    2     3
<strong>Output: <br></strong>Yes<strong>
Explanation: <br></strong>There are two trees both having 3 nodes and 2 edges, both trees are identical having the root as 1, left child of 1 is 2 and right child of 1 is 3.</span></pre>
<p><span style="font-size: 14pt;"><strong>Example 2:</strong></span></p>
<pre><span style="font-size: 14pt;"><strong>Input:
</strong>    1       1
&nbsp; /  \     /  \
&nbsp;2    3   3    2
<strong>Output: <br></strong>No<strong>
Explanation: </strong>There are two trees both having 3 nodes and 2 edges, but both trees are not identical.</span></pre>
<p><span style="font-size: 14pt;"><strong>Your task:</strong><br>Since this is a functional problem you don't have to worry about input, you just have to complete the function <strong>isIdentical()</strong> that takes two roots as parameters and returns true or false. The printing is done by the driver code.</span></p>
<p><span style="font-size: 14pt;"><strong>Expected Time Complexity: </strong>O(N).<br><strong>Expected Auxiliary Space:&nbsp;</strong>O(Height of the Tree).</span></p>
<p><span style="font-size: 14pt;"><strong>Constraints:</strong><br>1 &lt;= Number of nodes &lt;= 10<sup>5</sup><br>1 &lt;=Data of a node &lt;= 10<sup>9</sup></span></p></div><p><span style=font-size:18px><strong>Company Tags : </strong><br><code>Flipkart</code>&nbsp;<code>Amazon</code>&nbsp;<code>Microsoft</code>&nbsp;<br><p><span style=font-size:18px><strong>Topic Tags : </strong><br><code>Tree</code>&nbsp;<code>Data Structures</code>&nbsp;