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;}
}
Graphs are data structures which consist of a set of vertices & a set of edges which connect the vertices. A graph where the edges are directed is called directed graph. Or else, i
The size of stack was declared as ten. Thus, stack cannot hold more than ten elements. The major operations which can be performed onto a stack are push and pop. However, in a prog
Explain principle of Optimality It indicates that an optimal solution to any instance of an optimization problem is composed of optimal solutions to its subinstances.
disadvantage on duality principal
Ruby implements Range of T Abstract data type Ruby implements Range of T ADT in its Range class. Elements of carrier set are represented in Range instances by recording interna
AVL trees are applied into the given situations: There are few insertion & deletion operations Short search time is required Input data is sorted or nearly sorted
Illumination of wire frame The colour or shade that a surface appears to the human eye depends primarily on three factors : Colour and strength of incoming illumination
Data array A has data series from 1,000,000 to 1 with step size 1, which is in perfect decreasing order. Data array B has data series from 1 to 1,000,000, which is in random order.
Column Major Representation In memory the second method of representing two-dimensional array is the column major representation. Under this illustration, the first column of
As we have seen, as the traversal mechanisms were intrinsically recursive, the implementation was also easy through a recursive procedure. Though, in the case of a non-recursive me
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