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. Write down an algorithm to evaluate an expression given to you in postfix notation. Show the execution of your algorithm for the following given expression.
AB^CD-EF/GH+/+*
Ans.
Algorithm to evaluate Post fix Expression is shown as follows
Opndstk = the empty stack;
/*scan the input string reading one */
/*element at a time into symb */
while ( not end of input){
symb = next input character;
if (symb is an operand)
push (opndstk, symb);
else
{
/* symb is an operator */
opnd 2 = Pop (opnd stk);
opnd 1 = Pop (opnd stk);
value = result of applying symb to opnd 1 and opnd 2;
push (opndstk,value);
}/*end else */
}/*end while */
return (pop (opnd stk));
Symb
Opnd1
Opnd2
Value
Opndstk
A
B
A,B
^
A^B
C
A^B,C
D
A^B,C,D
-
C-D
A^B,C-D
E
A^B,C-D,E
F
A^B,C-D,E,F
/
E/F
A^B,C-D,E/F
G
A^B,C-D,E/F,G
H
A^B,C-D,E/F,G,H
+
G+H
A^B,C-D,E/F,G+H
(E/F)/(G+H)
A^B,C-D, (E/F) /(G+H)
(C-D)+(E/F)/(G+H)
A^B,(C-D)+
*
(C-
D)+(E/F)/(G+H)
A^B*((C-D)+
(E/F)/(G+H))
For AVL trees the deletion algorithm is a little more complicated as there are various extra steps involved in the deletion of node. If the node is not a leaf node, then it contain
What do you understand by tree traversal? The algorithm walks by the tree data structure and performs some computation at everynode in the tree. This process of walking by the
Example 3: Travelling Salesman problem Given: n associated cities and distances among them Find: tour of minimum length that visits all of city. Solutions: How several
Example: (Single rotation into AVL tree, while a new node is inserted into the AVL tree (LL Rotation)) Figure: LL Rotation The rectangles marked A, B & C are trees
State the ways to construct container taxonomy There are several ways that we could construct our container taxonomy from here; one way that works well is to make a fundamental
In computer programming, Trees are utilized enormously. These can be utilized for developing database search times (binary search trees, AVL trees, 2-3 trees, red-black trees), Gam
Do you have a library solution for this problem?
write an algorithm given each students name and grade points for six courses.find his grade point average and group students into the gpa groups 3.5
implement multiple stacks in an array and write different algorithms to perform operations on it
Which of the sorting algorithm is stable Heap sorting is stable.
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