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;}
}
How many nodes in a tree have no ancestors 1 node in atree have no ancestors.
Demonstrate that Dijkstra's algorithm does not necessarily work if some of the costs are negative by finding a digraph with negative costs (but no negative cost dicircuits) for whi
Q. The degree of a node is defined as the number of children it has. Shear show that in any binary tree, the total number of leaves is one more than the number of nodes of degree 2
Let us assume a file of 5 records that means n = 5 And k is a sorted array of keys of those 5 records. Let key = 55, low = 0, high = 4 Iteration 1: mid = (0+4)/2 = 2
Given the following search tree, state the order in which the nodes will be searched for breadth first, depth first, hill climbing and best first search, until a solution is reache
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
The smallest element of an array's index is called its Lower bound.
Triangular Matrices Tiangular Matrices is of 2 types: a) Lower triangular b) Upper triangular
(1) (i) Add the special form let to the metacircular interpreter Hint: remember let is just syntactic sugar for a lambda expression and so a rewrite to the lambda form is all t
Question 1 Write a program in 'C' to read N numbers and print them in descending order Question 2 Discuss the properties of ADT Question 3 Write a note on
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: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd