Execute algorithm to convert infix into post fix expression, Data Structure & Algorithms

Q. Execute your algorithm to convert the infix expression to the post fix expression with the given infix expression as input

Q = [(A + B)/(C + D) ↑ (E / F)]+ (G + H)/ I

 

Ans:

The given infix expression is as follows:-

Q = [(A + B) / (C + D) ^ (E + F)] + (G + H) / I

Symb               Stack                           Postfix Notation

[                    [

(                    [ (

A                  [ (                          A

+

[ ( +

 

B

[ ( +

AB

)

[

AB+

/

[ /

 

(

[ / (

 

C

[ / (

AB+C

+

[ / ( +

 

D

[ / ( +

AB+CD

)

[ /

AB+CD+

^

[ / ^

 

(

[ / ^ (

 

E

[ / ^ (

AB+CD+

/

[ / ^ ( /

AB+CD+

F

[ / ^

AB+CD+/

]

EMPTY

AB+CD+EF/^/

+

+

 

(

+ (

 

G

+ (

AB+CD+EF/^/G

+

+ ( +

 

H

+ ( +

AB+CD+EF/^/GH

)

+

AB+CD+EF/^/GH+

/

+ /

AB+CD+EF/^/GH+

I

+ /

AB+CD+EF/^/GH+I

POSTFIX is:-       AB+CD+EF/^/GH+I/+

Posted Date: 7/11/2012 1:21:35 AM | Location : United States







Related Discussions:- Execute algorithm to convert infix into post fix expression, Assignment Help, Ask Question on Execute algorithm to convert infix into post fix expression, Get Answer, Expert's Help, Execute algorithm to convert infix into post fix expression Discussions

Write discussion on Execute algorithm to convert infix into post fix expression
Your posts are moderated
Related Questions
Explain about Hidden-surface Hidden-line removal refers to wire-frame diagrams without surface rendering and polygonal surfaces with straight edges. Hidden-surface removal ref

Consider a linked list of n elements. What is the time taken to insert an element after an element pointed by some pointer? O (1)

State about the Simple types - Built-In Types Values of the carrier set are atomic, that is, they can't be divided into parts. Common illustrations of simple types are inte


Example: Assume the following of code: x = 4y + 3 z = z + 1 p = 1 As we have been seen, x, y, z and p are all scalar variables & the running time is constant irrespective

The time required to delete a node x from a doubly linked list having n nodes is O (1)

Now, consider a function that calculates partial sum of an integer n. int psum(int n) { int i, partial_sum; partial_sum = 0;                                           /* L

Question: (a) Discuss the importance of game theory to decisions. (b) Explain the following: (i) saddle point, (ii) two-person zero-sum game. (c) Two leading ?rms, ABC Ltd a

Q. Explain the term hashing? Explain any five well known hash functions.                         Ans: Hashing method provides us the direct access of record from the f

differentiate between indexing and hashing in file organization