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
What is selection in an algorithm?
What is time complexity of sorting algorithms?
State the difference between primitive and non-primitive data types?
Devise a program to sort an array using bubble sort.
Define tree edge?
What do you mean by Syntax Error
Define non linear data structure.
Explain the uses of binary tree.
How does hashset work internally in java?
What is the use of data structure in real life?
Which interfaces are implemented by enumset?
Is an arraylist a vector?
How expression trees are gets represented in data structure?
What is circular queue example?
What is the difference between push and pop?