recategorized by
1,511 views
1 votes
1 votes

Evaluation of the given postfix expression $10 \: 10 + 60 \: 6/^*8-$ is

  1. $192$
  2. $190$
  3. $110$
  4. $92$
recategorized by

3 Answers

3 votes
3 votes

Scan from left to right until you find two operands and one operator one after another. When found evaluate them.

$10 $ $10 $ $+ $ $60 $ $ 6 $$ /∗8- $

$= (10 +10) $ $ 60 $ $ 6/∗8- $

$= 20 $ $ 60 $ $ 6/ ∗8- $

$= 20 $ $ (60/6) $ $ *8- $

$= 20 $ $ 10 * 8 - $

$ = (20*10) 8 - $

$ = 200 $ $ 8 - $

$= (200 -8) $

$=192 $

$\therefore $ Option A is correct

2 votes
2 votes

ANSWER IS 192.  

SINCE IT IS POSTFIX EVALUATION,

WE WILL TRAVERSE THE GIVEN EXPRESSION FROM LEFT TO RIGHT ,

WHEN WE COME ACROSS THE OPERANDS WE KEEP ON  PUSHING THEM INTO THE STACK ,AND WHEN WE HIT A OPERATOR WE PERFORM THE OPERATION BETWEEN THE TOPMOST TWO OPERANDS IN THE STACK USING THE OPERATOR AND PUSH BACK THE RESULT.

.

 

Answer:

Related questions

5 votes
5 votes
5 answers
1
Arjun asked Dec 7, 2018
2,146 views
______ to evaluate an expression without any embedded function calls.Two stacks are requiredone stack is neededThree stacks are requiredMore than three stacks are require...
1 votes
1 votes
3 answers
2
Arjun asked Dec 7, 2018
1,292 views
The smallest element that can be found in time ____ in a binary max heap.$O(n \log n)$$O( \log n)$$O(n)$$O(n^2)$
1 votes
1 votes
2 answers
3
Arjun asked Dec 7, 2018
3,453 views
For a given hash table $T$ with $10$ slots that stores $1000$ elements, the load factor $\alpha$ for $T$ is$100$$0.01$$200$$1.05$
1 votes
1 votes
1 answer
4
Arjun asked Dec 7, 2018
4,327 views
____ is the worst-case time complexity for all operations (i.e.,) search, update and delete) in a general Binary Search tree$O(n)$$O(n \log n)$$O( \log n)$ for search and...