Convert following infix expression to the prefix expression.
a - b + c * (d / e - (f + g))
Answer Posted / ashish
Algorithm for Infix to Prefix Conversion is
1. Reverse the given expression ...
2. Apply algorithm of infix to post-fix conversion...
3. Again reverse the expression after the post-fix conversion...
Infix Expression is => a - b + c * (d / e - (f + g))
step 1: => ( g + f ) - e / d ) * c + b- a
step 2: => apply post-fix ...
( ( g f + ) - e d / ) * c + b - a
( g f + e d / - ) * c + b - a
g f + e d / - c * + b - a
g f + e d / - c * b + - a
g f + e d / - c * b + a -
step 3: => final step reverse the expression ...
Prefix Expression = - a + b * c - / d e + f g
...
source :: http://scanftree.com/Data_Structure/infix-to-prefix
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Which method will arrange the element of an array in alphabetical order?
Can we give size to arraylist?
What are vectors used for in real life?
Is quicksort greedy algorithm?
Tell me the difference between the character array and a string.
What is array indexing?
What is the difference between list and arraylist?
What do you mean by data types?
What is the difference between hashset and treeset?
What is stack in geography?
Is null allowed in list?
Give us a program to reverse a linked list.
Write code for reversing a linked list.
What are the operations that can be performed on a stack?
write a program to accept name & sort them?