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


Please Help Members By Posting Answers For Below Questions

Is there any difference between int[] a and int a[]?

759


Do you know how to find if linked list has loop?

814


What are types of Collision Resolution Techniques and the methods used in each of the types?

875


What is a tech stack?

646


What is red black tree in data structure?

668


How do you sort a map by key?

649


How would you use bsearch() function to search a name stored in array of pointers to string?

677


What is difference between while and do while?

660


What does the term sorting refer to?

780


What is map keyset?

651


Does arraylist have a tostring?

659


Which is faster array or list?

663


What is a singletonlist?

657


What are data and data types?

700


Explain Array

749