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

Answer Posted / rodel

given-> a - b + c * (d / e - (f + g))
note: remember, before we do the infix expression to postfix expression.
We analyze the given data by using the hierarchy of operation (PEMDAS)
In that way, we can do the operation, tracing the hierarchy nos...
sample:
a - b + c * (d / e - (f + g))
5 6 4 2 3 1
pass1: a - b + c * (d / e - (f g +)) infix -> postfix
pass2: a - b + c * (d e / - f g +) infix -> postfix
pass3: a - b + c * (d e / - f g +) infix -> postfix
pass4: a - b + c * (d e / f g + - ) infix -> postfix
pass5: a b - + c d e / f g + - * infix -> postfix

pass6: a b - c + d e / f g + - * infix -> postfix -> Final Answer

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is hashmap part of collection?

454


What is a priority queue?

557


Explain the difference between a list and array.

528


Define ancestor and descendant ?

538


How do hash tables work?

493






What is the use of sorting the data?

534


Define right-in threaded tree?

534


What is the top of a stack?

501


What are different types of linked lists?

463


What is scalar example?

511


Define red-black trees.

559


Differentiate between file and structure storage structure.

498


What is difference between rb tree and avl tree?

454


an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like. [ I ended up giving about 4 or 5 different solutions for this, each supposedly better than the others ].

549


What is selection sort with example?

586