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))
It is a useful tool for indicating the logical properties of data type. It is a collection of values & a set of operations on those values. Methodically, "a TYPE is a set, & elemen
Linear search employee an exhaustive method of verified each element in the array against a key value. Whereas a match is found, the search halts. Will sorting the array before uti
write a program that find,search&replace a text string
Q. Explain the complexity of an algorithm? What are the worst case analysis and best case analysis explain with an example.
Determine the Disjoint of division method A polygon is disjoint from the viewport if the x- and y-extents of the polygon do not overlap the viewport anywhere. In this case; reg
What is the best-case number of comparisons performed by mergesort on an input sequence of 2 k distinct numbers?
write a algorithsm in c to perform push and pop operations stastic implementation using array ?
Arrays are simple, however reliable to employ in more condition than you can count. Arrays are utilized in those problems while the number of items to be solved out is fixed. They
Insertion & deletion of target key requires splaying of the tree. In case of insertion, the tree is splayed to find the target. If, target key is found out, then we have a duplicat
what is far and near procedures in system programming?
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