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
Define threaded binary tree. Explain its common uses
What is binary tree and its properties?
What is a data structure node class?
What are the advantages and disadvantages of linked list?
Explain the difference between a list and array.
Describe tree database. Explain its common uses.
How does hashset work internally in java?
What is the prerequisite for binary searching?
Suppose in an integer array, there is 1 to 100 number, out of one is duplicate, how to find?
What method is used to place a value onto the top of a stack?
Why hashmap is faster than hashtable?
What is the method to find the complexity of an algorithm?
Can you distinguish between ArrayList and Array?
What is 2 dimensional linked list?
Why is sorting and classifying important?