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))
what are the disadvantages of sparse matrix?
In the last subsection, we have implemented a stack by using an array. While a stack is implemented by using arrays, it suffers from the basic restriction of an array - i.e., its s
nested for loop for (i = 0; i for (j = 0; j sequence of statements } } Here, we observe that, the outer loop executes n times. Every time the outer loop execute
The searching technique that takes O (1) time to find a data is Hashing is used to find a data
ALGORITHM (Insertion of element into a linked list) Step 1 Begin the program Step 2 if the list is empty or any new element comes before the start (head) element, then add t
Abstract Data Types :- A useful tool for specifying the logical properties of a data type is the abstract data type or ADT. The term "abstract data type" refers to the basic mathem
Write an algorithm to calculate a postfix expression. Execute your algorithm using the given postfix expression as your input : a b + c d +*f ↑ . T o evaluate a postfix expr
What is a Spanning tree of a graph? A Spanning Tree is any tree having of vertices of graph tree and some edges of graph is known as a spanning tree.
The first assignment in this course required you to acquire data to enable you to implement the PHYSAT algorithm (Alvain et al. 2005, Alvain et al. 2008) in this second assignment
Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4
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