Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Evaluate the following prefix expression " ++ 26 + - 1324"

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many types of searching are there in data structure?

782


What actions are performed when a function is called?

921


How to traverse data in a linked list in forward and backward direction, write the algorithm?

872


Define dynamic data structures?

945


Can I provide array size dynamically?

869


What are the different types of data structures explain briefly?

988


How does shell sort work?

880


What's the difference between a hashtable and a hashmap?

867


If you are given a choice to use either arraylist and linkedlist, which one would you use and why?

927


Explain linked list in short.

844


How efficient is binary search?

821


How do you declare An array of three char pointers

923


What is heap tree?

874


Is quicksort divide and conquer?

847


Provide an algorithm to reverse a linked list without using recursion.

883