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 the difference between array and stack in data structures?
What is the minimum number of nodes that a binary tree can have?
What is red black tree in data structure?
State the difference between arrays and linked lists?
What is dynamic data structure?
What are the different types of data type?
What is the height of an empty tree?
write a program to show the insertion and deletion of an element in an array using the position
What are the advantages of array?
Why does hashset use hashmap?
How do you sort large data?
What are doubly linked lists?
What do you mean by overflow and underflow?
What is long data type?
which is the simplest file structure? (Sequential, indexed, random)