Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Q. The two Binary Trees are said to be similar if they are both empty or if they are both non- empty and left and right sub trees are similar. Write down an algorithm to determine if two Binary Trees are similar.
Ans: We assume that the two trees are tree1 and tree2. an algorithm to determine if two Binary trees are similar or not is as follows: similar(*tree1,*tree2) { while((tree1!=null) && (tree2!=null)) { if((tree1->root) == (tree2->root)) similar(tree1->left,tree2->left); similar(tree1->right,tree2->right); elseif(tree->root!= tree2->node){printf("Trees are not equal"); return;} } }
Ans:
We assume that the two trees are tree1 and tree2. an algorithm to determine if two Binary trees are similar or not is as follows:
similar(*tree1,*tree2)
{
while((tree1!=null) && (tree2!=null))
if((tree1->root) == (tree2->root)) similar(tree1->left,tree2->left); similar(tree1->right,tree2->right);
elseif(tree->root!= tree2->node){printf("Trees
are not equal");
return;}
}
1. You are required to hand in both a hard copy and an electronic copy of the written report on the project described in A, including all the diagrams you have drawn. 2. You
adjacency multi list
1. In computer science, a classic problem is how to dynamically store information so as to let for quick look up. This searching problem arises frequently in dictionaries, symbol t
Explain the Interfaces in Ruby Recall that in object-oriented programming, an interface is a collection of abstract operations that cannot be instantiated. Even though Ruby i
This method is the reverse of FIFO and assumes that each issue of stock is made from latest items received in the enterprises .Thus if the last lot to be received is not sufficient
what is frequency count
How do you find the complexity of an algorithm? Complexity of an algorithm is the measure of analysis of algorithm. Analyzing an algorithm means predicting the resources that
Define Prim's Algorithm Prim's algorithm is a greedy algorithm for constructing a minimum spanning tree of a weighted linked graph. It works by attaching to a bef
1. Using the traditional method of CPM: a. What activities are on the critical path? b. What is the expected total lead time of the project? 2. Using CCPM: a. What
The location of a node in a binary search tree is defined as a string such as LLRRL, which represents the node that you find by starting at the root, and traversing Left, traverse
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +91-977-207-8620
Phone: +91-977-207-8620
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd