1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
svetlana [45]
3 years ago
14

Write a recursive function that calculates if two binary trees are similar?

Computers and Technology
1 answer:
ahrayia [7]3 years ago
5 0

Answer:

bool identicaltrees(Node* root1,Node* root2)//function of type boolean true if idenctical false if not.

{

   if(root1==NULL&&root2==NULL)//both trees are null means identical.

   return true;

   if(roo1 && root2)

   {

       if(root1->data==root2->data)//condition for recursive call..

       {

           return (identicaltrees(root1->left,root2->right)&&identicaltrees(root1->right&&root2->right);

       }

   }

   else

   return false;

}

Explanation:

In this function it of type boolean returns true if both the trees are identical return false if not.First we are checking root node of both the trees if both are null then they are identical returning true.

If both root nodes are not null then checking their data.If data is same then recursively traversing on both trees and checking both trees.

else returning false.

You might be interested in
Write a valid HTML + Python page that will count numbered from 1 to 1,000,000?​
valentinak56 [21]

Answer:

I remember before the corona virus we used to do math at school

8 0
3 years ago
___________ is a task pane used to correct grammar errors; opens when you click the Spelling & Grammar button in the Proofin
BaLLatris [955]

Answer:

Spelling Task Pane

Explanation:

According to my research on Microsoft Office Studio, I can say that based on the information provided within the question the feature being mentioned in the question is called the Spelling Task Pane. By selecting this pane word will offer various grammar and spelling assistance, such as correcting words and offering one or more suggestions.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

7 0
3 years ago
Read 2 more answers
Which of these printers would be the most suitable for printing a large number of high quality black and white printouts?
Alex777 [14]

Answer:

A laser pointer

Explanation:

A laser printer would be the most suitable printer for printing a large number of high quality black and white printouts

8 0
3 years ago
Minerals that contain the elements silicon and oxygen are called ______.
mojhsa [17]
Silcates are minerals with silicon bonded with oxygen.
7 0
2 years ago
Which software fits into the category of a productivity software?
aniked [119]
I believe photoshop since it has elements of productivity
4 0
2 years ago
Other questions:
  • Hanging out with friends, watching your favorite TV show, and buying a pair of new shoes are all examples of _____ for doing wel
    5·2 answers
  • A small company has hired you to take over its IT needs. The company currently has seven on-site employees and 12 remote employe
    12·1 answer
  • I know how to design it but I’m confused as to how to write a function code based on the info provided.
    10·1 answer
  • Explain the importance of mobile computing in communication​
    7·2 answers
  • How long does it take to send a 8 MiB file from Host A to Host B over a circuit-switched network, assuming: Total link transmiss
    11·1 answer
  • Convert hexadecimal number 1AF2 to a decimal number.
    7·1 answer
  • Want to.learn about computers​
    9·1 answer
  • You need to update both the DEPARTMENT_ID and LOCATION_ID columns in the EMPLOYEES table using one UPDATE statement. Which claus
    5·1 answer
  • What happens if none of the selector values match selector in a simple case expression in pl/sql
    6·1 answer
  • A Computer Programmer who wants to be surrounded by a large number of like-minded coworkers should take a job with one of the na
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!