Evaluate the following prefix expression " ++ 26 + - 1324"
Answer Posted / 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 |
Post New Answer View All Answers
What is collection sort?
What is data structures in computer science?
What is the difference between hashset and linkedhashset?
Which is the parent class of list
Is array size dynamic or fixed?
State the difference between arrays and linked lists?
What is the space complexity of selection sort?
How does a selection sort work for an array?
What is a weighted graph?
Can you please explain the difference between string and an array?
Can you list out the areas in which data structures are applied extensively?
Is null allowed in list?
What is a dequeue?
What do you mean by overflow and underflow?
What do you mean by external sorting?