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
Explain binary searching, Fibonacci search.
Write a program to reverse a link list.
Why you need a data structure?
How does a selection sort work?
Differentiate between hashmap and hashtable.
How to traverse data in a linked list in forward and backward direction, write the algorithm?
What is a directed graph?
What is the meaning of anonymous array? Explain with an example?
How many links are there in a binary tree of N nodes?
What package is arraylist?
For searches. Which one is most preferred: array list or linked list?
How would you reverse characters of an array without using indexing in the array.
Does arraylist extend list?
Define Data Structures?
What is nsmutablearray?