php hit counter

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how can we write the postfix expression of 3 + 5 * 6 – 7 * (8 + 5)?
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#1
The algorithm to convert infix to postfix is given on page 71 in handouts.
In simple words,
if operand:
write in postfix string.
if operator:
if top of stack has more precedence than this operator
pop top of stack and append in postfix string. Continue until false. push new operator on stack
else if top of stack has less precedence than this operator
push it on stack

So, for the infix expression:
3 + 5 * 6 - 7 * ( 8 + 5)


Symbol


Postfix


Stack

3


3




+


3


+

5


3 5


+

*


3 5


*

+

6


3 5 6


*

+

-


3 5 6 *


-

+

7


3 5 6 * 7


-

+

*


3 5 6 * 7


*

-

+

(


3 5 6 * 7


(

*

-

+

8


3 5 6 * 7 8


(

*

-

+

+


3 5 6 * 7 8


+

(

*

-

+

5


3 5 6 * 7 8 5


+

(

*

-

+

)


3 5 6 * 7 8 5 +


*

-

+




3 5 6 * 7 8 5 + * - +



0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Messages In This Thread
how can we write the postfix expression of 3 + 5 * 6 – 7 * (8 + 5)? - by Vuhelper - 01-04-2012, 10:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Why we write main rgc,char**argv in C++ 2012 Vuhelper 0 3,152 01-04-2012, 10:36 PM
Last Post: Vuhelper
  what are the relationship between prefix infix and postfix give an example? Vuhelper 0 2,417 11-05-2011, 05:06 PM
Last Post: Vuhelper
  How to write a summation in a sequence? C++ 2011-12 Vuhelper 2 1,563 09-19-2011, 04:53 AM
Last Post: Xpert
  How to write Wav files in c++ 2011 Vuhelper 0 1,172 07-22-2011, 08:48 PM
Last Post: Vuhelper
  How to write Wav files in c++ Vuhelper 0 1,570 07-19-2011, 06:37 PM
Last Post: Vuhelper
  Write a calculator program using a do-while loop in c++ 2011 Vuhelper 0 2,902 06-27-2011, 06:41 PM
Last Post: Vuhelper
  How to Write a function factorial in C++ and java and php 2011 Xpert 1 2,679 05-12-2011, 10:02 PM
Last Post: dawoodasad17
  write a function to calcute the power of some number, will we only save it or we will sana.pari 2 2,063 04-24-2011, 06:17 PM
Last Post: Support
  how i can write a right program without any errors n i do bsc in double math physics sana.pari 1 2,317 04-24-2011, 05:20 PM
Last Post: Support

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support