Evaluate the following prefix expression " ++ 26 + - 1324"
Answers were Sorted based on User's Feedback
Answer / a khan
I am new to this but i will try like this
This looks tricky.... i may not be right. There might be on
+/- missing in the original expression but if it is not
then...
+8+-224
+8+04
+84
12
| Is This Answer Correct ? | 22 Yes | 22 No |
Answer / bipin from utkal university mc
here one operator id missing
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / narayan kunal
for evaluating the prefix expression first reverse the
prefix expression then sole like postfix expression
the reverse of given expression is
4231-+62++
then push 4,2,3,1 to stack ,now pop last two elements and
1-3=-2
now again push -2 to stack,now the element of stack is 4,2
,-2 again pop last two elements and do
-2+2=0
we know that if zero comes like symbol then we directly pop
this and proceed to next step
now the content of stack is 4 lets go to the next step
push 6 and 2 to the stack so now content of stack is 4,6,2
now
pop last two elements
6+2=8
push 8 to stack
content of stack is 4,8
again remove last two elements of elements and do
4+8=12
now all operator and operand ends up
so final answer is 12
| Is This Answer Correct ? | 2 Yes | 2 No |
Answer / varun
(2+6)+((13-2)+4)=23
this is the correct answer...
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / pallab datta
One operator is missing in this expression. There are six operands ( 2, 6, 1, 3, 2, 4 ) and four operators ( + , + , + , - ). The number of operators must be exactly 1 less than the number of operands to be a proper expression. Here the number of operator is 2 less than the number of operands. Hence evaluation of this expression is not possible.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / majeed
++26+-1324
=+(2+6)+(1-3)24
=(2+6)+(1-3)+(24)
=8+(-2)+24
=8-2+24
=6+24
30
++26+-1324
=+(2+6)+(13-24)
=8-11
=-3
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / vivek
take a stack and push operators into stack such as (*,+,_,/,etc) and when 2 operands(let a & B) appears pop out 1 operator and perform the expression (a operator B) and push it in 2 a stack
eg: ++2 6+-13 2 4
+(2+6) +-13 2 4
+8+(13-2)4
+8+11 4
+8(11+4)
+8 15
8+15
23 ans
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / ravi shikharhcu
If operator is not missing then answer of uma shankar is
correct.
| Is This Answer Correct ? | 6 Yes | 9 No |
Answer / naman
there are 4 operators and 6 operands. how can this be a
correct prefix exp ? ans1 and 2 are correct with there
assumptions..
| Is This Answer Correct ? | 6 Yes | 9 No |
How to excel in data structures and algorithms?
Why use a tuple instead of a list?
Tell me do array subscripts always start with zero?
Does treeset allow null?
Is hashmap fail safe?
What do you mean by sorting data?
What is the best data structure and algorithm to implement cache?
Is unordered_map a hash table?
What do you mean by disjoint set adt?
How do I rearrange rows in numbers?
What are the applications of b-tree?
Differentiate null and void?