edited by
454 views
1 votes
1 votes

$\text{ABC}{\ast}+$ is the postfix form of :

  1. $ \text{A}\;{\ast}\; \text{B} + \text{C} $
  2. $ \text{A}{\ast} + \text{BC} $
  3. $ \text{A} + \text{B}\;{\ast}\; \text{C} $
  4. none of these
edited by

1 Answer

3 votes
3 votes

I always solve these type of questions using stack. If the given expression is postfix expression, traverse from left to right and if the given expression is prefix expression, traverse from right to left.

For this, we’ll traverse from left to right and when we encounter the operator, we will put the top operand to right of the operator and second most top element to the left of the operator and push back the result into stack. See the image below.

 

 

 

 

 

 

 

 

 

For the given question, the procedure will look like this:-

 

 

 

 

 

 

 

So the correct option is C.

edited by

Related questions

0 votes
0 votes
1 answer
1
soujanyareddy13 asked Dec 7, 2021
926 views
Write Recurrence of Quick Sort in worst case.$ \text{T(n)} = \text{T (n-1)} + 1 $$ \text{T(n)} = \text{T (n-1) + n} $$ \text{T(n)} = 2 \text{T (n-1) + n} $$ \text{T(n)} =...
0 votes
0 votes
0 answers
2
soujanyareddy13 asked Dec 7, 2021
535 views
$y = 10 \cos (1800 \; \pi t) + 20 \cos (2000 \; \pi t) + 10 \cos (220 \; \pi t).$ Find the modulation index $(\mu)$ of the given wave. $0.3$$0.5$$0.7$$1$
0 votes
0 votes
1 answer
3
soujanyareddy13 asked Dec 7, 2021
589 views
Match the following:$$\begin{array} {llll} & \textbf{List-I} & & \textbf{List-II} \\ \text{W.} & \text{Condition coverage} & 1. & \text{Black-box testing} \\ \text{X.} ...
0 votes
0 votes
2 answers
4
soujanyareddy13 asked Dec 7, 2021
3,260 views
_________ is the class of decision problems that can be solved by non-deterministic polynomial algorithms.$\text{NP}$$\text{P}$HardComplete