• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
June 08, 2023 |1.8K Views
Determine if Two Trees are Identical or Not
Description
Discussion

In this video, we will discuss a problem to determine if given two trees are identical or not.

For example: 

Input:    1          1
             /   \      /   \
           2     3    2     3
Output: Yes

Explanation: There are two trees both having 3 nodes and 2 edges, both trees are identical having the root as 1, the left child of 1 is 2 and the right child of 1 is 3.

Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!

Do check out:-

Article:  https://www.geeksforgeeks.org/write-c-code-to-determine-if-two-trees-are-identical/
Problem: https://practice.geeksforgeeks.org/problems/determine-if-two-trees-are-identical/1
SDE Sheet: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/

 

Read More