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;}
}
Define the terms i) Key attribute ii) Value set Key attribute: An entity type usually has an attribute whose values are distinct fr
You are given two jugs, a 4-gallon one and a 3-gallon one. Neither has any measuring marker on it. There is a tap that can be used to fill the jugs with water. How can you get exac
In a chained hash table, each table entry is a pointer to a collection of elements. It can be any collection that supports insert, remove, and find, but is commonly a linked list.
Two-dimensional array is shown in memory in following two ways: 1. Row major representation: To achieve this linear representation, the first row of the array is stored in th
Explain the term - Branching There are two common ways of branching: case of ..... otherwise ...... endcase if ..... then ..... else ..... endif case of
The searching technique that takes O (1) time to find a data is Hashing is used to find a data
What is called the basic operation of an algorithm? The most significant operation of the algorithm is the operation contributing the most to the total running time is known as
Define the term counting - Pseudocode Counting in 1s is quite simple; use of statement count = count + 1 would enable counting to be done (for example in controlling a repeat
How can the third dimension be displayed on the screen The main problem in visualization is the display of three-dimensional objects and scenes on two-dimensional screens. How
Area Subdivision Method In this method, the viewport is examined for clear decisions on the polygons situated in it, in regard to their overlap and visibility to the viewer. Fo
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