Office Document APIs for .NET
ITIL Career Advice
PMP Career Advice
Android Intel XDK
Welcome Guest !
Data Structures & Algorithms
Infix Expression: a+b*c/d
What will be the equivalent Postfix expression?
on 10/12/2015 | Category:
Data Structures & Algorithms Interview questions
| Views: 1063 |
Select from following answers:
a b c * d + /
a b c * d / +
a b + c d * /
a b c + d / *
First Character is Alphabet (i.e. 'a'). Display It in Postfix string. (Current Output in Postfix string: a)
Second character is Operator(i.e. '+') and stack is empty, push '+' to stack. (Current Output in Postfix string: a)
Third Character is Alphabet (i.e. 'b'). Display It in Postfix string. (Current Output in Postfix string: ab)
Fourth character is Operator(i.e. '*') and stack has already '+' as the top element of the stack .But '+' has lower precedence than '*' so push '*' to stack(Stack status *+). (Current Output in Postfix string: ab)
Fifth Character is Alphabet (i.e. 'c'). Display It in Postfix string. (Current Output in Postfix string: abc)
Sixth character is Operator(i.e. '/') and stack has already '*+'. Since '*' has a higher precedence than '/', this will be poped out from stack and will be added to Postfix string. Since '/' has higher precedence that '+', hence it will be added to stack (Stack status /+). (Current Output in Postfix string: abc*)
Seventh Character is Alphabet (i.e. 'd'). Display It in Postfix string. (Current Output in Postfix string: abc*d)
Now all characters have been scanned so we must pop the remaining elements from the stack and add it to the Postfix string. So the final Postfix string will be
Show Correct Answer
Many Interviews |
< Previous :
We have an input as : "6abc67*uv3$%^78*(op23 ...
Next > :
How can you prevent user to enter duplicate value ...
Comments or Responses
Login to post response
More Interview Questions by Rajnilari2015
Which command will move only csv files from one location to another?
Which Powershell cmdlet is sends HTTP and HTTPS requests to Representa ...
With an example how can we create a Table Valued Parameter in Sql Serv ...
Which kind of object does SQL Server 2008 provided by using which we c ...
How to pass table variable as a parameter in Sql Server Stored Procedu ...
What is Yield Statement?
What is using statement in C#?
Explain Param Array with example
Latest Interview Questions
How can you prevent user to enter duplicate value into column while cr ...
What is AngularJS?
What is the role of implementation phase in STLC(Software Testing Life ...
What is test plan ?
What is test planning?
Your are designing User interface(UI) Window Store App.It must be fast ...
What is Automation Testing ?
What is manual testing and what are its drawbacks ?