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
Proxy data:
lapo4ka [179]

Answer: provide climate data representing times when instruments were not available to measure them.

Explanation:

Proxy data provides climate data representing times when instruments were not available to measure them.

6 0
4 years ago
Jennifer is trying to install an anti-malware program on a computer that she believes might be infected. During the installation
sesenic [268]

Answer:

B. Install in Safe Mode.

Explanation:

Since Jennifer is using the administrator account, she should be able to install the program.

Hence, she should install the anti-malware software in Safe Mode.

In Computer science, Safe Mode is a mode in which the operating system loads only the bare minimum services, process and programs to boot or start up.

Hence, Safe Mode will ensure that when Jennifer is installing the anti-malware software, no other program or service is running which may interfere with her installation.

4 0
3 years ago
I have $80 and I want a smartphone that you can call for free what should I get
SVEN [57.7K]
Downloading an apps than provides u a free chat and video call .
6 0
3 years ago
Read 2 more answers
A speech that a person delivers without preparation is called
Bad White [126]
A. an impromptu speech.
5 0
2 years ago
For this exam review lab exercise, you will develop a program that fixes faulty data in a one-dimensional array of integers. Fau
Paladinen [302]

Answer:

start with what you know

Explanation:

3 0
3 years ago
Other questions:
  • To remove an embedded chart, you should _____ it and press the DELETE key.
    14·2 answers
  • Prodeff, an online project management software, is available at a price of $1 per use. The software requires the user to enter t
    13·1 answer
  • Intro to Computers quiz answers me need for test please help me hurry
    5·1 answer
  • How to find determinant of ​
    15·1 answer
  • Jerry recently purchased a new iPad. He needs guidance on setting it up and wants to find documentation to help with the setup.
    9·2 answers
  • PLS ANSWER ASAP I WILL GIVE BRAINLIEST
    11·1 answer
  • What alternative to leased lines is used by VPNs? As an alternative to leased lines, VPNs use ______ connections.
    11·1 answer
  • Which of these is not an application software?
    6·2 answers
  • Which of the following is needed to connect to the Internet? HELP ASAP
    9·1 answer
  • What is DMTS. Explain it​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!