Wednesday, September 9, 2009

Algorithm for converting infix expression to prefix expression

Algorithm

PREFIX (Q, P)

Suppose Q is an expression written in infix notation. This algorithm finds equivalent prefix expression P.

1) Reverse the infix expression Q with exchanging left and right parenthesis and store into Q.
2) Convert Q into postfix P using algorithm1.
3) Reverse the expression P and get prefix expression.
4) Exit

0 comments:

Post a Comment

 

About

Site Info

Information Source

Lecture Notes Copyright © 2009 Community is Developed by Rajesh Kumar Rolen WebSite

/* tracking code by yahoo login */