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
Which of the following statements is true about scalability? Choose 3 options.
Simora [160]

Answer:

4, 5, 2

Explanation:

just did it on edge :)

3 0
3 years ago
Read 2 more answers
Which is true about SSH and Telnet?
MaRussiya [10]

Answer:

Data is encrypted on SSH

Explanation:

Telnet and SSH both are the networking protocols. These protocol are used for the security of data. In telnet data is sent over the link without any encryption. That is the reason, in telnet protocol data is less secure.

In SSH (Security Shell) protocol data has been encrypted before transmission. The encryption of data make it more secure between transmitter and receiver.

So the true statement is that, SSH has data encryption.

8 0
3 years ago
With the help of ________, the digital version of a document is displayed on the screen for a human viewer to verify letters the
Nostrana [21]

With the help of Intelligent Character Recognition, the digital version of a document is displayed on the screen for a human viewer to verify letters the software cannot read.

6 0
3 years ago
Read 2 more answers
For his class project, Matt has to create an image in a color scheme that has shade or tint variations of the same hue. Which co
Alex

Answer:

B.Monochromatic

Explanation:

mono means one

5 0
3 years ago
hackers can use as part of a reconnaissance process to learn about active network addresses and active processes?
aalyn [17]

Answer:

ICMP.

Explanation:

Hackers might use ICMP for gain knowledge about current system addresses and specific procedures as part of a reconnaissance process.

ICMP is a failure informing system used by network protocols such as routers to produce warning to that of the source Address while network issues interrupt IP packet transmission.

3 0
3 years ago
Other questions:
  • Several days a week, usually between 8:00 a.m. and 9:00 a.m., users complain of MWI problems. Some have new messages, but their
    11·1 answer
  • How can i take out a random (double) number in between 5.0 to 15.0 in c++?
    7·1 answer
  • Which system tool allows you to manage the available space on your hard disk to improve efficiency? A. ScanDisk B. Anti-Virus C.
    10·1 answer
  • Which two technologies support the building of single-page applications? and are two technologies helpful in building single pag
    12·1 answer
  • A presentation has bullet points that move. The presenter wants to use these bullet points in several other places in the presen
    6·1 answer
  • Create a view named Top10PaidInvoices that returns three columns for each vendor: VendorName, LastInvoice (the most recent invoi
    12·1 answer
  • Java code?????
    12·1 answer
  • A VALENTINE
    5·2 answers
  • 2. The internet offers a great source of information; however, how are
    9·1 answer
  • In which of these areas can software engineers specialize?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!