Convert following infix expression to the prefix expression.
a - b + c * (d / e - (f + g))

Answer Posted / naresh

first u need to reverse the given string like this..
))g+f(-e/d(*c+b-a..
after doing this, we need to consider a stack n insert symbolls into the stack whenever u encountered it in the string..
sequence of flow is:
g
f
+
e
d
/
-
c
*
b
+
a
-......
the string obtained is gf+ed/-c*b+a-..
u need to reverse the string for answer i.e
ans is -a+b*c-/de+fg..

Is This Answer Correct ?    28 Yes 23 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does hashset maintain order?

662


How to cut or remove an element from the array?

717


What are the scenarios in which an element can be inserted into the circular queue?

1104


Is array size dynamic or fixed?

708


Which collection class is thread safe?

615


Which interface provides the capability to store objects using a key-value pair?

789


Model a data structure for a DFA that takes an event as parameter and performs a desired action.

879


What is the difference between hashmap and arraylist?

701


Explain the uses of matrix with an example?

755


Define linked lists?

668


What does args stand for?

654


What is the purpose of tochararray ()?

653


Define linked list data structure.

749


What is the Insertion Sort Code?.

815


What is declaring array?

651