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))
Before programming a problem solution those employees a stack, we have to decide how to represent a stack by using the data structures which exist in our programming language. Stac
Explain All-pair shortest-paths problem Given a weighted linked graph (undirected or directed), the all pairs shortest paths problem asks to find the distances (the lengths of
In this respect depth-first search (DFS) is the exact reverse process: whenever it sends a new node, it immediately continues to extend from it. It sends back to previously explore
Data type An implementation of an abstract data type on a computer. Therefore, for instance, Boolean ADT is implemented as the Boolean type in Java, and bool type in C++;
Merge sort: Merge sort is a sorting algorithm that uses the idea of split and conquers. This algorithm splits the array into two halves, sorts them separately and then merges t
Q. Establish the usage of linked lists for polynomial manipulation. Ans. Usag e of Linked List for Polynomial Manipulation. Link
A striking application of DFS is determine a strongly connected component of a graph. Definition: For graph G = (V, E) , where V refer to the set of vertices and E refer to the
1) The set of the algorithms whose order is O (1) would run in the identical time. True/False 2) Determine the complexity of the following program into big O notation:
Graph terminologies : Adjacent vertices: Two vertices a & b are said to be adjacent if there is an edge connecting a & b. For instance, in given Figure, vertices 5 & 4 are adj
You have to sort a list L having of a sorted list followed by a few "random" elements. Which sorting methods would be especially suitable for this type of task? Insertion sort
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